3

We have an XFS volume mounted on RHEL9.5 (5.14.0-503.22.1.el9_5.x86_64) with only 88K files on it:

$ find /mnt -type f | wc -l
87739

The file system reports ~200GB of free space. However, the total - real used gives ~4TB.

$ df /mnt
Filesystem        1K-blocks         Used Available Use% Mounted on
/dev/sda1      558602657792 558397210232 205447560 100% /mnt

$ du -s /mnt 554502450484 /mnt

The difference between filesystem total size and the sum of file sizes

558602657792 - 554502450484
4100207308

Where is the lost space, and how can we reclaim it? As suggested by other answers, we have tried xfs_fsr and xfs_repair, but nothing has changed.

kofemann
  • 5,151

1 Answers1

4

The missing space is most probably allocated by the filesystem itself.

I created an LVM with 540TB using multiple thin provisioned disks and formatted it with XFS. Here is the result:

$ sudo mkfs.xfs /dev/mapper/vg_test-lv_test
meta-data=/dev/mapper/vg_test-lv_test isize=512    agcount=540, agsize=268435455 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=1
         =                       reflink=1    bigtime=1 inobtcount=1 nrext64=0
data     =                       bsize=4096   blocks=144955133952, imaxpct=1
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=521728, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
$ sudo mount /dev/mapper/vg_test-lv_test /mnt
$ df -h /mnt
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg_test-lv_test  540T   11T  530T   2% /mnt
$ du -hs /mnt
0       /mnt

Not a single file on it and 11TB out of 540TB are used.

I also replicated the tests in this answer with the larger filesystem, running the mkfs.xfs with different values for reflink and crc.

$ df -h /mnt/
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg_test-lv_test  540T   11T  530T   2% /mnt (reflink=1, crc=1)
/dev/mapper/vg_test-lv_test  540T  7.2T  533T   2% /mnt (reflink=0, crc=1)
/dev/mapper/vg_test-lv_test  540T   58M  540T   1% /mnt (reflink=0, crc=0)

As you can see, the used space varies widely depending on the xfs settings.

Tests were conducted on Ubuntu 24.04 with default settings if not mentioned otherwise.

Gerald Schneider
  • 26,582
  • 8
  • 65
  • 97