Useful XFS Utilities
If you have a large partition with XFS that for some reason often enough was almost 100% full, then the files on it can be quite fragmented. In order to verify this and use online defragmentation, you need to install xfs_utils, xfsdump.
For Debian / Ubuntu we do it.
We see how much the partition is fragmented. So now that we have found that defragmenting the partition doesn’t hurt, we will use the fact that xfs can perform partition defragmentation online. Run After the first pass, the result. To perform several passes at once, you can start with the -p parameter or specify how long it takes to work with -t
For Debian / Ubuntu we do it.
sudo apt-get install xfs_utils xfsdump
We see how much the partition is fragmented. So now that we have found that defragmenting the partition doesn’t hurt, we will use the fact that xfs can perform partition defragmentation online. Run After the first pass, the result. To perform several passes at once, you can start with the -p parameter or specify how long it takes to work with -t
sudo xfs_db -r /dev/sdb1
xfs_db> frag
actual 278616, ideal 24966, fragmentation factor 91.04%
sudo xfs_fsr -v /dev/sdb1
/home/ftp start inode=0
ino=163
extents before:2 after:1 DONE ino=163
ino=169
extents before:2 after:1 DONE ino=169
ino=171
extents before:2 after:1 DONE ino=171
ino=1391
......
xfs_db> frag
actual 48121, ideal 24966, fragmentation factor 48.12%