Mounted USB drive shows wrong data usage

Hello,

I have a 1TB USB drive mounted with SambaNAS to be used as data storage for Frigate.
The drive is formatted to EXT4 and empty.
But Frigate reports 46GB already in use.

du -sh shows the actual size of the data (around 5mb)
df -h shows wrong data already in use (46G)

Any idea what is causing this, because Frigate also displays the 46G where the video data size is shown.

You most probably know that you can remove a file that still in use by some application and for this application it remains available. It because file descriptor in /proc/ filesystem is held open.

So if there are such open descriptors to files already removed, space occupied by them considered as used by df (and df is right), but they can not be taken into account by du due to there are no longer filenames associated with them.

You can find all unlinked but held open files with:

# lsof | grep '(deleted)'

I understand what you’re saying, but this couldn’t be the case if I formatted the drive just minutes before, right?

lsof | grep ‘(deleted)’ shows nothing.

There may be other reasons as well that they show differently. Sometimes it is due to how the storage is mounted.

I asked this question also to the owner of SambaNAS and he told me the following:

This is the 5% space reserved to root/superuser. It is a default for ext4 fs.

Ref:archlinux wiki )

1 Like