The XFS File system is a high-performance journaling file system. XFS supports a maximum file system size of 500 TB and a maximum file size of 16 TB. You can create an XFS file system on a regular disk partition and on a logical volume. It performs incredibly well under a heavy load and scales with large files, but as a result, it is also susceptible to damage, and it is with this in mind that we now consider a set of tools that will enable us to troubleshoot the server and restore the filesystem.

 

Additional XFS utilities are available to perform file system maintenance. These utilities include the following:

 

  • xfs_fsr: XFS is an extent-based file system. The xfs_fsr utility reorganizes and improves the layout of the file extents, which improves overall performance. Run this command on a mounted XFS file system or on individual files in the file system.
  • xfs_repair: Repair a corrupted or damaged XFS file system. Unmount the file system before running this command. If the file system cannot be repaired, restore files from a backup with xfsrestore.
  • xfs_db: Debug an XFS file system. This utility provides a command set that allows you to perform scans on the file system and to navigate and display its data structures.

 

Repair a XFS filesystem using xfs_repair

 

The xfs_repair utility can be used to repair a corrupted or damaged XFS file system. The basic syntax used by xfs_repair is as follows:

# xfs_repair /mount/point 

 

NOTE:

Make sure you umount the XFS filesystem first before running the xfs_repair command.

 

Similar to the fsck utility, the xfs_repair utility fixes unmounted xfs filesystems in series of phases. Sample output from an XFS repair is as shown below:

# xfs_repair /dev/mapper/vg_test-lv_test 
Phase 1 - find and verify superblock...
        - reporting progress in intervals of 15 minutes
Phase 2 - using internal log
        - zero log...
        - scan filesystem freespace and inode maps...
        - 12:57:37: scanning filesystem freespace - 291 of 291 allocation groups done
        - found root inode chunk
Phase 3 - for each AG...
        - scan and clear agi unlinked lists...
        - 12:57:37: scanning agi unlinked lists - 291 of 291 allocation groups done
        - process known inodes and perform inode discovery...
        ...
        ...
Metadata corruption detected at xfs_inode block 0x60/0x2000
Metadata corruption detected at xfs_inode block 0x60/0x2000
Metadata corruption detected at xfs_inode block 0x60/0x2000
Metadata corruption detected at xfs_inode block 0x60/0x2000
Metadata corruption detected at xfs_inode block 0x60/0x2000
Metadata corruption detected at xfs_inode block 0x60/0x2000
Metadata corruption detected at xfs_inode block 0x60/0x2000
Metadata corruption detected at xfs_inode block 0x60/0x2000
Metadata corruption detected at xfs_inode block 0x60/0x2000
Metadata corruption detected at xfs_inode block 0x60/0x2000

Phase 4 - check for duplicate blocks...
        - setting up duplicate extent list...
        - 12:57:37: setting up duplicate extent list - 291 of 291 allocation groups done
        - check for inodes claiming duplicate blocks...
Phase 5 - rebuild AG headers and trees...
        - 12:57:37: rebuild AG headers and trees - 291 of 291 allocation groups done
        - 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...
        - 12:57:37: verify and correct link counts - 291 of 291 allocation groups done
done 

 

If you just want to check for filesystem problems, but not fix any problems, run the xfs_check command instead of the xfs_repair command.

# xfs_check /dev/mapper/vg_test-lv_test 
Metadata corruption detected at xfs_inode block 0x40/0x8000
Metadata corruption detected at xfs_inode block 0x40/0x8000
Metadata corruption detected at xfs_inode block 0x40/0x8000
Metadata corruption detected at xfs_inode block 0x40/0x8000
Metadata corruption detected at xfs_inode block 0x40/0x8000
Metadata corruption detected at xfs_inode block 0x40/0x8000
Metadata corruption detected at xfs_inode block 0x40/0x8000
Metadata corruption detected at xfs_inode block 0x40/0x8000
Metadata corruption detected at xfs_inode block 0x40/0x8000
Metadata corruption detected at xfs_inode block 0x40/0x8000
bad magic number 0xfe3d for inode 100
bad magic number 0xa756 for inode 101
bad magic number 0xd375 for inode 102
bad magic number 0x88f5 for inode 103
bad magic number 0xc7cd for inode 104
bad magic number 0xc95 for inode 105
bad magic number 0xaeaf for inode 106
bad magic number 0x10c4 for inode 107
bad magic number 0xf137 for inode 108
bad magic number 0x8157 for inode 109
         69 file1 

 

You can alsu use the “xfs_repair -n” command to do a dry run for xfs_repair. Some distributions does not include the xfs_check command. In that case you can use this option as they work in the same way.

# xfs_repair -n /dev/mapper/vg_test-lv_test 
.....
Phase 7 - verify link counts...
        - 13:02:55: verify and correct link counts - 291 of 291 allocation groups done
No modify flag set, skipping filesystem flush and exiting. 

 

?האם התשובה שקיבלתם הייתה מועילה 0 משתמשים שמצאו מאמר זה מועיל (0 הצבעות)