当前位置:网站首页>Backup, recovery and repair of XFS file system
Backup, recovery and repair of XFS file system
2022-07-02 07:59:00 【Teacher Liu Trent】
XFS File system is a silicon valley graphics company (Silicon Graphics Inc, abbreviation SGI) Developed for IRIX( One UNIX operating system ) File system , After the XFS Migration to Linux On the operating system .XFS It's an advanced log file system , Its characteristics are highly scalable , It's also very robust .2000 year 5 month XFS adopt GNU General public license porting to Linux System On , After more than ten years of constant modification, it has become a very mature file system . In a number of cases XFS On the performance test of ,XFS All of them have made great achievements , In high concurrency environments, it has even exceeded ext4. |
One 、XFS File system backup and recovery
XFS The file system provides a backup tool for the entire partition xfsdump For user's use , Users can use third-party software without the help of third-party software XFS The data on the file system is backed up .
establish XFS Partition and test files
[[email protected] ~]# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sdb
[[email protected] ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x08a5199d
Device Boot Start End Blocks Id System
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +1G
Partition 1 of type Linux and of size 1 GiB is set
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x08a5199d
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[[email protected] ~]# partprobe
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
[[email protected] ~]# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sdb /dev/sdb1
[[email protected] ~]# mkfs.xfs -f /dev/sdb1
meta-data=/dev/sdb1 isize=512 agcount=4, agsize=65536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[[email protected] ~]# blkid /dev/sdb1
/dev/sdb1: UUID="61a5e59d-92d3-458d-ac09-7d945469cda6" TYPE="xfs"
[[email protected] ~]# mkdir /file
[[email protected] ~]# echo "/dev/sdb1 /file xfs defaults 0 0" >> /etc/fstab
[[email protected] ~]# mount -a
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 17G 1.9G 16G 12% /
devtmpfs 901M 0 901M 0% /dev
tmpfs 912M 0 912M 0% /dev/shm
tmpfs 912M 8.7M 903M 1% /run
tmpfs 912M 0 912M 0% /sys/fs/cgroup
/dev/sr0 3.8G 3.8G 0 100% /yum
/dev/sda1 1014M 143M 872M 15% /boot
tmpfs 183M 0 183M 0% /run/user/0
/dev/sdb1 1014M 33M 982M 4% /file
[[email protected] ~]# cd /file/
[[email protected] file]# ls
[[email protected] file]# touch file{1..100}
[[email protected] file]# ls
file1 file16 file23 file30 file38 file45 file52 file6 file67 file74 file81 file89 file96
file10 file17 file24 file31 file39 file46 file53 file60 file68 file75 file82 file9 file97
file100 file18 file25 file32 file4 file47 file54 file61 file69 file76 file83 file90 file98
file11 file19 file26 file33 file40 file48 file55 file62 file7 file77 file84 file91 file99
file12 file2 file27 file34 file41 file49 file56 file63 file70 file78 file85 file92
file13 file20 file28 file35 file42 file5 file57 file64 file71 file79 file86 file93
file14 file21 file29 file36 file43 file50 file58 file65 file72 file8 file87 file94
file15 file22 file3 file37 file44 file51 file59 file66 file73 file80 file88 file95
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
Backup XFS Partition
[[email protected] file]# mkdir /backup
[[email protected] file]# yum install -y xfsdump
[[email protected] file]# xfsdump -f /backup/file.bak /file
# utilize xfsdump Backup mount point /file Corresponding partition
xfsdump: using file dump (drive_simple) strategy
xfsdump: version 3.1.4 (dump format 3.0) - type ^C for status and control
============================= dump label dialog ==============================
# Input dump Session label
please enter label for this dump session (timeout in 300 sec)
-> file.bak
session label entered: "file.bak"
--------------------------------- end dialog ---------------------------------
xfsdump: level 0 dump of localhost.localdomain:/file
xfsdump: dump date: Thu Oct 31 22:16:02 2019
xfsdump: session id: 02a1445f-5ff3-4518-ab2c-888d9e2a4c44
xfsdump: session label: "file.bak"
xfsdump: ino map phase 1: constructing initial dump list
xfsdump: ino map phase 2: skipping (no pruning necessary)
xfsdump: ino map phase 3: skipping (only one dump stream)
xfsdump: ino map construction complete
xfsdump: estimated dump size: 52800 bytes
============================= media label dialog =============================
# Enter the media label
please enter label for media in drive 0 (timeout in 300 sec)
-> file
media label entered: "file"
--------------------------------- end dialog ---------------------------------
xfsdump: creating dump session media file 0 (media 0, file 0)
xfsdump: dumping ino map
xfsdump: dumping directories
xfsdump: dumping non-directory files
xfsdump: ending media file
xfsdump: media file size 86544 bytes
xfsdump: dump size (non-dir files) : 0 bytes
xfsdump: dump complete: 27 seconds elapsed
xfsdump: Dump Summary:
xfsdump: stream 0 /backup/file.bak OK (success)
xfsdump: Dump Status: SUCCESS
[[email protected] file]# ls /backup/
# The backup file has been successfully created
file.bak
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
Recovery process
[[email protected] file]# ls
file1 file16 file23 file30 file38 file45 file52 file6 file67 file74 file81 file89 file96
file10 file17 file24 file31 file39 file46 file53 file60 file68 file75 file82 file9 file97
file100 file18 file25 file32 file4 file47 file54 file61 file69 file76 file83 file90 file98
file11 file19 file26 file33 file40 file48 file55 file62 file7 file77 file84 file91 file99
file12 file2 file27 file34 file41 file49 file56 file63 file70 file78 file85 file92
file13 file20 file28 file35 file42 file5 file57 file64 file71 file79 file86 file93
file14 file21 file29 file36 file43 file50 file58 file65 file72 file8 file87 file94
file15 file22 file3 file37 file44 file51 file59 file66 file73 file80 file88 file95
[[email protected] file]# rm -rf *
[[email protected] file]# ls
[[email protected] file]# xfsrestore -f /backup/file.bak /file
xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.4 (dump format 3.0) - type ^C for status and control
xfsrestore: searching media for dump
xfsrestore: examining media file 0
xfsrestore: dump description:
xfsrestore: hostname: localhost.localdomain
xfsrestore: mount point: /file
xfsrestore: volume: /dev/sdb1
xfsrestore: session time: Thu Oct 31 22:16:02 2019
xfsrestore: level: 0
xfsrestore: session label: "file.bak"
xfsrestore: media label: "file"
xfsrestore: file system id: 61a5e59d-92d3-458d-ac09-7d945469cda6
xfsrestore: session id: 02a1445f-5ff3-4518-ab2c-888d9e2a4c44
xfsrestore: media id: 2d1d9f33-dff3-4cfa-a2f6-bf65bd8f242b
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: reading directories
xfsrestore: 1 directories and 100 entries processed
xfsrestore: directory post-processing
xfsrestore: restoring non-directory files
xfsrestore: restore complete: 0 seconds elapsed
xfsrestore: Restore Summary:
xfsrestore: stream 0 /backup/file.bak OK (success)
xfsrestore: Restore Status: SUCCESS
[[email protected] file]# ls
# The deleted file has been successfully recovered
file1 file16 file23 file30 file38 file45 file52 file6 file67 file74 file81 file89 file96
file10 file17 file24 file31 file39 file46 file53 file60 file68 file75 file82 file9 file97
file100 file18 file25 file32 file4 file47 file54 file61 file69 file76 file83 file90 file98
file11 file19 file26 file33 file40 file48 file55 file62 file7 file77 file84 file91 file99
file12 file2 file27 file34 file41 file49 file56 file63 file70 file78 file85 file92
file13 file20 file28 file35 file42 file5 file57 file64 file71 file79 file86 file93
file14 file21 file29 file36 file43 file50 file58 file65 file72 file8 file87 file94
file15 file22 file3 file37 file44 file51 file59 file66 file73 file80 file88 file95
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
Two 、XFS File system check and repair establish XFS Test partition
[[email protected] file]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x08a5199d
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2):
First sector (2099200-41943039, default 2099200):
Using default value 2099200
Last sector, +sectors or +size{K,M,G} (2099200-41943039, default 41943039): +1G
Partition 2 of type Linux and of size 1 GiB is set
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x08a5199d
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[[email protected] file]# partprobe
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
[[email protected] file]# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sdb /dev/sdb1 /dev/sdb2
[[email protected] file]# mkfs.xfs /dev/sdb2
meta-data=/dev/sdb2 isize=512 agcount=4, agsize=65536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
Check XFS file system , If problems are found during the inspection, a list of
[[email protected] file]# xfs_repair -n /dev/sdb2
Phase 1 - find and verify superblock...
Phase 2 - using internal log
- zero log...
- scan filesystem freespace and inode maps...
- found root inode chunk
Phase 3 - for each AG...
- scan (but don't clear) agi unlinked lists...
- process known inodes and perform inode discovery...
- agno = 0
- agno = 1
- agno = 2
- agno = 3
- process newly discovered inodes...
Phase 4 - check for duplicate blocks...
- setting up duplicate extent list...
- check for inodes claiming duplicate blocks...
- agno = 0
- agno = 1
- agno = 2
- agno = 3
No modify flag set, skipping phase 5
Phase 6 - check inode connectivity...
- traversing filesystem ...
- traversal finished ...
- moving disconnected inodes to lost+found ...
Phase 7 - verify link counts...
No modify flag set, skipping filesystem flush and exiting.
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
Automatically check and repair XFS file system
[[email protected] file]# xfs_repair /dev/sdb2
Phase 1 - find and verify superblock...
Phase 2 - using internal log
- zero log...
- scan filesystem freespace and inode maps...
- found root inode chunk
Phase 3 - for each AG...
- scan and clear agi unlinked lists...
- process known inodes and perform inode discovery...
- agno = 0
- agno = 1
- agno = 2
- agno = 3
- process newly discovered inodes...
Phase 4 - check for duplicate blocks...
- setting up duplicate extent list...
- check for inodes claiming duplicate blocks...
- agno = 0
- agno = 1
- agno = 2
- agno = 3
Phase 5 - rebuild AG headers and trees...
- reset superblock...
Phase 6 - check inode connectivity...
- resetting contents of realtime bitmap and summary inodes
- traversing filesystem ...
- traversal finished ...
- moving disconnected inodes to lost+found ...
Phase 7 - verify and correct link counts...
done
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
边栏推荐
- [CVPR‘22 Oral2] TAN: Temporal Alignment Networks for Long-term Video
- EKLAVYA -- 利用神经网络推断二进制文件中函数的参数
- Open3d learning note 5 [rgbd fusion]
- 最长等比子序列
- Summary of solving the Jetson nano installation onnx error (error: failed building wheel for onnx)
- Command line is too long
- Pointnet understanding (step 4 of pointnet Implementation)
- 【TCDCN】《Facial landmark detection by deep multi-task learning》
- Business architecture diagram
- Ppt skills
猜你喜欢

【学习笔记】反向误差传播之数值微分

服务器的内网可以访问,外网却不能访问的问题
![[mixup] mixup: Beyond Imperial Risk Minimization](/img/14/8d6a76b79a2317fa619e6b7bf87f88.png)
[mixup] mixup: Beyond Imperial Risk Minimization

TimeCLR: A self-supervised contrastive learning framework for univariate time series representation

【Random Erasing】《Random Erasing Data Augmentation》

Traditional target detection notes 1__ Viola Jones

用MLP代替掉Self-Attention

【Wing Loss】《Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks》

图像增强的几个方法以及Matlab代码

静态库和动态库
随机推荐
用C# 语言实现MYSQL 真分页
【Random Erasing】《Random Erasing Data Augmentation》
Graph Pooling 简析
笔记本电脑卡顿问题原因
【DIoU】《Distance-IoU Loss:Faster and Better Learning for Bounding Box Regression》
I'll show you why you don't need to log in every time you use Taobao, jd.com, etc?
【Cascade FPD】《Deep Convolutional Network Cascade for Facial Point Detection》
MoCO ——Momentum Contrast for Unsupervised Visual Representation Learning
【BiSeNet】《BiSeNet:Bilateral Segmentation Network for Real-time Semantic Segmentation》
【MnasNet】《MnasNet:Platform-Aware Neural Architecture Search for Mobile》
Daily practice (19): print binary tree from top to bottom
One book 1078: sum of fractional sequences
AR系统总结收获
Dynamic extensible representation for category incremental learning -- der
open3d环境错误汇总
【Wing Loss】《Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks》
jetson nano安装tensorflow踩坑记录(scipy1.4.1)
[learning notes] matlab self compiled image convolution function
【学习笔记】Matlab自编高斯平滑器+Sobel算子求导
Income in the first month of naked resignation