DAY-09ktjf笔记
1.1 使用xfs文件系统superblock实验
- 创建一个XFS文件系统
[root@localhost ~]# mkfs.xfs -f /dev/sdb1
meta-data=/dev/sdb1 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 sdsb1
/dev/sdb1 /test xfs defaults 0 0
[root@localhost ~]# mount -a
[root@localhost ~]# df -h
/dev/sdb1 30G 610M 30G 2% /test
2. 卸载文件系统/test, 并且破坏superblock
[root@localhost ~]# umount /test
[root@localhost ~]# dd if=/dev/zero of=/dev/sdb1 bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00251096 s, 204 kB/s
- 再次挂载报错
[root@localhost ~]# mount -a
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
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 (sdb1): bad magic number
[22597379.624372] XFS (sdb1): SB validate failed
4. 恢复superblock
xfs_repair 此为XFS系统恢复和修改文件系统工具 (ext系列工具为fsck)
[root@localhost ~]# xfs_repair /dev/sdb1
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 poin