I've been dealing with an issue whereby df is reporting a much larger usage of an exfat partition mounted onto my system from a USB drive.
df -h
gives:
Filesystem Size Used Avail Use% Mounted on
/dev/sdb3 4.6T 4.2T 396G 92% /media/smb
Whereas du -ch
reports:
3.7T .
3.7T total
This led me to investigate inode counts using the same methodology.
From df -i
I get:
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sdb3 19M 17M 1.6M 92% /media/smb
and du -ch --inodes
shows:
3.5K .
3.5K total
Intuitively, knowing the number of files on that partition, 3.5K reads as the correct number, whereas 17M from df
seems wildly inflated.
How can I figure out why there's such a large disparity in inodes used?
I've restarted the machine and it persists, and similarly I've restarted all the docker containers on my machine that mount folders from this drive as volumes.
Running lsof +L1
(and lsof +L1 /media/smb
) shows very few orphaned files
root@couch:~# lsof +L1 /media/smb
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/123/gvfs
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NLINK NODE NAME
networkd- 845 root txt REG 179,2 5490352 0 2228342 /usr/bin/python3.8 (deleted)
unattende 963 root txt REG 179,2 5490352 0 2228342 /usr/bin/python3.8 (deleted)
unattende 963 root 3w REG 179,2 113 0 1181000 /var/log/unattended-upgrades/unattended-upgrades-shutdown.log.1 (deleted)
Xorg 1198 gdm 28u REG 0,1 4 0 33475 /memfd:xshmfence (deleted)
pulseaudi 1342 gdm 6u REG 0,1 67108864 0 33746 /memfd:pulseaudio (deleted)
none 1523 root txt REG 0,1 17032 0 37099 / (deleted)
container 431005 root txt REG 179,2 10556952 0 2232052 /usr/bin/containerd-shim-runc-v2 (deleted)
container 431020 root txt REG 179,2 10556952 0 2232052 /usr/bin/containerd-shim-runc-v2 (deleted)
container 431046 root txt REG 179,2 10556952 0 2232052 /usr/bin/containerd-shim-runc-v2 (deleted)
container 431089 root txt REG 179,2 10556952 0 2232052 /usr/bin/containerd-shim-runc-v2 (deleted)
container 431100 root txt REG 179,2 10556952 0 2232052 /usr/bin/containerd-shim-runc-v2 (deleted)
container 431109 root txt REG 179,2 10556952 0 2232052 /usr/bin/containerd-shim-runc-v2 (deleted)
container 431144 root txt REG 179,2 10556952 0 2232052 /usr/bin/containerd-shim-runc-v2 (deleted)
container 431203 root txt REG 179,2 10556952 0 2232052 /usr/bin/containerd-shim-runc-v2 (deleted)