几品飞车|XFS文件系统的备份、恢复、修复( 三 )

二、XFS文件系统的检查和修复
创建XFS测试分区
[root@localhost file]# fdisk /dev/sdbWelcome 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): pDisk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x08a5199dDevice BootStartEndBlocksIdSystem/dev/sdb120482099199104857683LinuxCommand (m for help): nPartition type:pprimary (1 primary, 0 extended, 3 free)eextendedSelect (default p): pPartition number (2-4, default 2): First sector (2099200-41943039, default 2099200): Using default value 2099200Last sector, +sectors or +size{K,M,G} (2099200-41943039, default 41943039): +1GPartition 2 of type Linux and of size 1 GiB is setCommand (m for help): pDisk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x08a5199dDevice BootStartEndBlocksIdSystem/dev/sdb120482099199104857683Linux/dev/sdb220992004196351104857683LinuxCommand (m for help): wThe 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 atthe next reboot or after you run partprobe(8) or kpartx(8)Syncing disks.[root@localhost file]# partprobeWarning: Unable to open /dev/sr0 read-write (Read-only file system)./dev/sr0 has been opened read-only.[root@localhost file]# ls /dev/sd*/dev/sda/dev/sda1/dev/sda2/dev/sdb/dev/sdb1/dev/sdb2[root@localhost file]# mkfs.xfs /dev/sdb2meta-data=http://kandian.youth.cn/dev/sdb2isize=512agcount=4, agsize=65536 blks=sectsz=512attr=2, projid32bit=1=crc=1finobt=0, sparse=0data=bsize=4096blocks=262144, imaxpct=25=sunit=0swidth=0 blksnaming=version 2bsize=4096ascii-ci=0 ftype=1log=internal logbsize=4096blocks=2560, version=2=sectsz=512sunit=0 blks, lazy-count=1realtime =noneextsz=4096blocks=0, rtextents=0检查XFS文件系统 , 如果检查过程中发现问题将会列出
[root@localhost file]# xfs_repair -n /dev/sdb2Phase 1 - find and verify superblock...Phase 2 - using internal log- zero log...- scan filesystem freespace and inode maps...- found root inode chunkPhase 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 = 3No modify flag set, skipping phase 5Phase 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.


推荐阅读