📜 ⬆️ ⬇️

Useful utilities for working with XFS

If you have a large section with XFS which, for some reason, was quite often filled up almost 100%, then the files on it can be quite fragmented. To check this and use online defragmentation, you need to install xfs_utils, xfsdump.
For Debian / Ubuntu run
sudo apt-get install xfs_utils xfsdump
We look how much fragmented section
sudo xfs_db -r /dev/sdb1
xfs_db> frag
actual 278616, ideal 24966, fragmentation factor 91.04%

So now, when we figured out that defragmenting a partition does not hurt - let's use the fact that xfs knows how to conduct online defragmentation of a partition.
Run
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
......

After the first pass, the result
xfs_db> frag
actual 48121, ideal 24966, fragmentation factor 48.12%

To perform several passes at once, you can run with the -p parameter or specify how long to work with -t

')

Source: https://habr.com/ru/post/37373/


All Articles