Disk /dev/mapper/olddata-home: 176.9 GB, 176898965504 bytes, 345505792 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
客户的服务器,突然开不了机,大概是磁盘有问题。让机房重新找个磁盘,重装centos 7,装完后,把这个旧磁盘挂载上去。结果在挂载磁盘的过程中,提示:
[root@localhost /]# mount /dev/mapper/olddata-home /data3
mount: mount /dev/mapper/olddata-home on /data3 failed: Structure needs cleaning
客户有100多G的数据,没有备份,只能是活马当死马医了。其实这种情况的出现,很可能是机房意外断电,导致系统没有正常关机,系统日志有点问题,导致系统无法启动,修复下磁盘按说是可以解决问题的。
xfs_repair -L /dev/mapper/olddata-home
执行了上面的命令,修复文件系统,下面是执行过程:
[root@localhost /]# xfs_repair -L /dev/mapper/olddata-home
Phase 1 - find and verify superblock...
Phase 2 - using internal log
- zero log...
ALERT: The filesystem has valuable metadata changes in a log which is being
destroyed because the -L option was used.
- scan filesystem freespace and inode maps...
Metadata CRC error detected at xfs_allocbt block 0xfaffc38/0x1000
btree block 3/507783 is suspect, error -74
bad magic # 0x340cb973 in btcnt block 3/507783
agf_freeblks 4963941, counted 4963401 in ag 3
agf_btreeblks 563, counted 562 in ag 3
sb_ifree 183157, counted 144647
sb_fdblocks 21552161, counted 21269479
- 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 = 3
- agno = 2
- agno = 1
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...
Maximum metadata LSN (1329113463:-1024357339) is ahead of log (1:2).
Format log to cycle 1329113466.
done
[root@localhost /]#mount /dev/mapper/olddata-home /data3
然后就可以用命令挂载磁盘了,完美解决。