1

I have several systems using glusterfs and xfs partitions. Some of these systems are hosts for VMs (using libvirt and with qcow2 for storage).

I noticed that there was some substantial fragmentation in several cases so I ran xfs_fsr to defrag. Two of my VMs are rather large and I receive an "insufficient freespace" when attempting to defrag the partitions they are hosted on.

Is there a way around this? I'm not sure I understand the -f option, is that what I should use?

EDIT: I took out a related question that I will ask in a different post.

1 Answers1

0

xfs_fsr defragments a file by copying it to a new temporary location and atomically swap the new (contiguous) file with the old one. This obviously means that it really need sufficient space to make the temporary copy (ie: at least as much free space as the file you are defragmenting).

From xfs_fsr man page:

xfs_fsr improves the layout of extents for each file by copying the entire file to a temporary location and then interchanging the data extents of the target and temporary files in an atomic manner. This method requires that enough free disk space be available to copy any given file and that the space be less fragmented than the original file. It also requires the owner of the file to have enough remaining filespace quota to do the copy on systems running quotas. xfs_fsr generates a warning message if space is not sufficient to improve the target file.

Its -f option enable you to specify the progress file location which, in turn, is used when restoring an interrupted defrag session. Again, from the man page:

-f leftoff

Use this file instead of /var/tmp/.fsrlast to read the state of where to start and as the file to store the state of where reorganization left off.

shodanshok
  • 44,038
  • 6
  • 98
  • 162
  • Hi thanks. Am I correct in thinking the free space must also be on the same partition? There is definitely enough space on that system, but on other partitions. – user3889271 Oct 15 '18 at 17:49
  • Yes, you are correct: free space must be in the same partition (and filesystem). – shodanshok Oct 15 '18 at 18:00