On 10/11/23 1:07 PM, Nagisa BIOS wrote: > Hi, > > I found that if the xfs_fsr program defrag the large files, it may cause errors. > > My recommend is, do not defrag the large files if the available disk space is not enough. The only slight problem I really see here is that the "full filesystem defrag" mode keeps trying and failing on the same file - a 21G file, on a filesystem with only 15G free. (xfs_fsr works by allocating new space, and moving data if the new space is less fragmented than the original, then swapping extents from the new inode to the old, and vice versa. If you're trying to defrag a file which is larger than your available free space, it will fail.) While full-filesystem defrag is rarely recommended, it might be nice to not loop like this, and perhaps someone can look into that behavior. On the other hand, the default is to keep trying for 2 hours and/or 10 passes, so perhaps this is working as designed. There are several reasons a file might fail to be defragged, so stopping on failure may not be desired. -Eric > Computer Setup (My Mini PC): > 1135G7 CPU Mini PC > 8GB DDR4 DRAM > 500GB NVMe SSD > 200GB NTFS Partition: Windows 11 > 200GB NTFS Partition > 75GB XFS Partition: Ubuntu (GNOME) 22.04 > > Pastebin: > > ubuntu@minipc:~$ xfs_fsr -V > xfs_fsr version 5.13.0 > > # nvme0n1p6 is XFS filesystem > ubuntu@minipc:~$ sudo df -h > Filesystem Size Used Avail Use% Mounted > tmpfs 772M 2.3M 770M 1% /run > /dev/nvme0n1p6 74G 55G 19G 75% / > tmpfs 3.8G 0 3.8G 0% /dev/shm > tmpfs 5.0M 4.0K 5.0M 1% /run/lock > tmpfs 3.8G 0 3.8G 0% /run/qemu > /dev/nvme0n1p1 256M 90M 167M 35% /boot/efi > tmpfs 772M 120K 772M 1% /run/user/1000 > > # win10.qcow2 file size is 21GB > ubuntu@minipc:~$ sudo ls -hs /var/lib/libvirt/images > total 26G > 2.5G debian12-1.qcow2 1.7G debian12-2.qcow2 34M win10-1.qcow2 34M win10-2.qcow2 > 21G win10.qcow2 595M win2003-1.qcow2 502M win2003.qcow2 > > # Loop and stuck > ubuntu@minipc:~$ sudo xfs_fsr > xfs_fsr -m /proc/mountfs -t 7200 -f /var/tmp/.fsrlast_xfs ... > / start inode=151308975 > / start inode=0 > XFS_IOC_SWAPEXT failed: ino=117672225: Invalid argument > insufficient freespace for: ino=117681809: size=21608017920: ignoring > / start inode=0 > XFS_IOC_SWAPEXT failed: ino=117672225: Invalid argument > insufficient freespace for: ino=117681809: size=21608017920: ignoring > / start inode=0 > XFS_IOC_SWAPEXT failed: ino=117672225: Invalid argument > insufficient freespace for: ino=117681809: size=21608017920: ignoring > / start inode=0 > XFS_IOC_SWAPEXT failed: ino=117672225: Invalid argument > insufficient freespace for: ino=117681809: size=21608017920: ignoring > / start inode=0 > XFS_IOC_SWAPEXT failed: ino=117672225: Invalid argument > insufficient freespace for: ino=117681809: size=21608017920: ignoring > > Pastebin (another Debian KVM): > > # vda1 is XFS filesystem > debian@kvm:~$ sudo df -h > Filesystem Size Used Avail Use% Mounted > udev 440M 0 448M 0% /dev > tmpfs 94M 656K 94M 1% /run > /dev/vda1 9.3G 1.4G 7.9G 15% / > tmpfs 470M 0 470M 0% /dev/shm > tmpfs 5.0M 0 5.0M 0% /run/lock > /dev/vda2 121M 5.9M 115M 5% /boot/efi > tmpfs 94M 0 94M 0% /run/user/1000 > > # Normal case > debian@kvm:~$ sudo xfs_fsr > xfs_fsr -m /proc/mountfs -t 7200 -f /var/tmp/.fsrlast_xfs ... > / start inode=0 > / start inode=0 > / start inode=0 > / start inode=0 > / start inode=0 > / start inode=0 > / start inode=0 > / start inode=0 > / start inode=0 > / start inode=0 > Completed all 10 passes > >