恢复xfs文件系统superblock实验
生活随笔
收集整理的這篇文章主要介紹了
恢复xfs文件系统superblock实验
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1. 創建一個XFS文件系統
[root@localhost ~]# mkfs.xfs -f /dev/vdb1
meta-data=/dev/vdb1 ? ? ? ? ? ? ?isize=256 ? ?agcount=4, agsize=1966102 blks
? ? ? ? = ? ? ? ? ? ? ? ? ? ? ? sectsz=512 ? attr=2, projid32bit=0
data ? ? = ? ? ? ? ? ? ? ? ? ? ? bsize=4096 ? blocks=7864408, imaxpct=25
? ? ? ? = ? ? ? ? ? ? ? ? ? ? ? sunit=0 ? ? ?swidth=0 blks
naming ? =version 2 ? ? ? ? ? ? ?bsize=4096 ? ascii-ci=0
log ? ? ?=internal log ? ? ? ? ? bsize=4096 ? blocks=3840, version=2
? ? ? ? = ? ? ? ? ? ? ? ? ? ? ? sectsz=512 ? sunit=0 blks, lazy-count=1
realtime =none ? ? ? ? ? ? ? ? ? extsz=4096 ? blocks=0, rtextents=0
[root@localhost ~]# cat /etc/fstab |grep vdb1
/dev/vdb1 ? ? /test ? ? xfs ? ? defaults ? ? 0 0
[root@localhost ~]# mount -a
[root@localhost ~]# df -h
/dev/vdb1 ? ? ? ? ? ? ? ? ? ? ? ? 30G ?610M ? 30G ? 2% /test
2. 卸載文件系統/test, 并且破壞superblock
[root@localhost ~]# umount /test
[root@localhost ~]# dd if=/dev/zero of=/dev/vdb1 bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00251096 s, 204 kB/s
3. 再次掛載報錯
[root@localhost ~]# mount -a
mount: wrong fs type, bad option, bad superblock on /dev/vdb1,
? ? ? missing codepage or helper program, or other error
? ? ? In some cases useful info is found in syslog - try
? ? ? dmesg | tail ?or so
[root@localhost ~]# dmesg
[22597379.623449] XFS (vdb1): bad magic number
[22597379.624372] XFS (vdb1): SB validate failed
4. 恢復superblock
[root@localhost ~]# xfs_repair /dev/vdb1
Phase 1 - find and verify superblock...
bad primary superblock - bad magic number !!!
attempting to find secondary superblock...
.........found candidate secondary superblock...
verified secondary superblock...
writing modified primary superblock
sb realtime bitmap inode 18446744073709551615 (NULLFSINO) inconsistent with calculated value 129
resetting superblock realtime bitmap ino pointer to 129
sb realtime summary inode 18446744073709551615 (NULLFSINO) inconsistent with calculated value 130
resetting superblock realtime summary ino pointer to 130
Phase 2 - using internal log
? ? ? ?- zero log...
? ? ? ?- scan filesystem freespace and inode maps...
sb_icount 0, counted 64
sb_ifree 0, counted 60
sb_fdblocks 7860552, counted 7712768
? ? ? ?- 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...
Note - stripe unit (0) and width (0) fields have been reset.
Please set with mount -o sunit=<value>,swidth=<value>
done
5. 確認是否已經恢復
[root@localhost ~]# mount -a
[root@localhost ~]# df -h
/dev/vdb1 ? ? ? ? ? ? ? ? ? ? ? ? 30G ?610M ? 30G ? 2% /test
[root@localhost ~]# mkfs.xfs -f /dev/vdb1
meta-data=/dev/vdb1 ? ? ? ? ? ? ?isize=256 ? ?agcount=4, agsize=1966102 blks
? ? ? ? = ? ? ? ? ? ? ? ? ? ? ? sectsz=512 ? attr=2, projid32bit=0
data ? ? = ? ? ? ? ? ? ? ? ? ? ? bsize=4096 ? blocks=7864408, imaxpct=25
? ? ? ? = ? ? ? ? ? ? ? ? ? ? ? sunit=0 ? ? ?swidth=0 blks
naming ? =version 2 ? ? ? ? ? ? ?bsize=4096 ? ascii-ci=0
log ? ? ?=internal log ? ? ? ? ? bsize=4096 ? blocks=3840, version=2
? ? ? ? = ? ? ? ? ? ? ? ? ? ? ? sectsz=512 ? sunit=0 blks, lazy-count=1
realtime =none ? ? ? ? ? ? ? ? ? extsz=4096 ? blocks=0, rtextents=0
[root@localhost ~]# cat /etc/fstab |grep vdb1
/dev/vdb1 ? ? /test ? ? xfs ? ? defaults ? ? 0 0
[root@localhost ~]# mount -a
[root@localhost ~]# df -h
/dev/vdb1 ? ? ? ? ? ? ? ? ? ? ? ? 30G ?610M ? 30G ? 2% /test
2. 卸載文件系統/test, 并且破壞superblock
[root@localhost ~]# umount /test
[root@localhost ~]# dd if=/dev/zero of=/dev/vdb1 bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00251096 s, 204 kB/s
3. 再次掛載報錯
[root@localhost ~]# mount -a
mount: wrong fs type, bad option, bad superblock on /dev/vdb1,
? ? ? missing codepage or helper program, or other error
? ? ? In some cases useful info is found in syslog - try
? ? ? dmesg | tail ?or so
[root@localhost ~]# dmesg
[22597379.623449] XFS (vdb1): bad magic number
[22597379.624372] XFS (vdb1): SB validate failed
4. 恢復superblock
[root@localhost ~]# xfs_repair /dev/vdb1
Phase 1 - find and verify superblock...
bad primary superblock - bad magic number !!!
attempting to find secondary superblock...
.........found candidate secondary superblock...
verified secondary superblock...
writing modified primary superblock
sb realtime bitmap inode 18446744073709551615 (NULLFSINO) inconsistent with calculated value 129
resetting superblock realtime bitmap ino pointer to 129
sb realtime summary inode 18446744073709551615 (NULLFSINO) inconsistent with calculated value 130
resetting superblock realtime summary ino pointer to 130
Phase 2 - using internal log
? ? ? ?- zero log...
? ? ? ?- scan filesystem freespace and inode maps...
sb_icount 0, counted 64
sb_ifree 0, counted 60
sb_fdblocks 7860552, counted 7712768
? ? ? ?- 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...
Note - stripe unit (0) and width (0) fields have been reset.
Please set with mount -o sunit=<value>,swidth=<value>
done
5. 確認是否已經恢復
[root@localhost ~]# mount -a
[root@localhost ~]# df -h
/dev/vdb1 ? ? ? ? ? ? ? ? ? ? ? ? 30G ?610M ? 30G ? 2% /test
轉載于:https://blog.51cto.com/torvalds0310/1388828
總結
以上是生活随笔為你收集整理的恢复xfs文件系统superblock实验的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android配置activity
- 下一篇: 切切切切切切切