Is "df" broken?
I have an external USB drive I use for backups, and I'm preparing to swap it out for a fresh one. It was full, and I'm been cleaning it a bit before the swap. In doing so I've found that
# df -B 1 <mount_point>
That surprises me a little ...
Ubuntu 20.04 LTS
# df --version
df (GNU coreutils) 8.28
@ColinTheMathmo What file system on that drive? If it's an ext* fs, could it be a combo of reserved blocks and fs overhead? The total blocks is definitely raw blocks, not what's available to the fs, just checking on a drive that I have and adding the used/avail up.
@cefiar It's EXT4 ... I'm finding that the Usage number goes up and down exactly as expected. Archive files to a tarball, the "Used" figure goes up. Remove the originals, the "Used" figure goes down.
The "Available" and "Use%" figures remain static at 0 and 100% respectively, even when subtracting or dividing "Used" and "Total" appropriately show that they should not be.
It's as if a "needle" got to the limit of its travel and got stuck there.
@ColinTheMathmo @cefiar The answer depends what you want; I think if you run the df as root it'll give you the real answer; as a normal user it's telling you what is available to use. If you just want it to let you use all the disk as a normal user then use tune2fs -m 0 to remove the reserved blocks.
@ColinTheMathmo @cefiar The reserved blocks are there for 2 reasons; 1) So when a user fills up the root directory they dont stop system processes from working 2) The block allocation algorithms get much less efficient when the disk is nearly full. (1) is irrelevant in your case, (2) is probably mostly irrelevant.
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!