92

As the output of df -h shows here, something is eating up 5GB of free space. So, it's not available to use.

I'm also noticing sometimes that the hard disk gets filled up to 100% sometimes. So, I had to restart the machine or delete some unncessary files. Only noticed these in /home partition. Don't know whether these two are related, but appreciate if anyone can put some insight into this.

$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda8             100G   92G  2.7G  98% /home
2
  • 4
    Possible duplicate of ext4 partition size / free space discrepancies Commented Apr 27, 2018 at 20:48
  • 3
    My reason for "leave open" is that the "Possible duplicate" question is extremely long. Good for being informative there wile not good here as this question is only about 1/20 as long. Not even similar. Commented Apr 29, 2018 at 9:28

3 Answers 3

137

By default, ext2/3/4 filesystems reserve 5% of the space to be useable only by root. This is to avoid a normal user completely filling the disk which would then cause system components to fail whenever they next needed to write to the disk.

You can see the number of reserved blocks (and lots of other information about the filesystem) by doing:

sudo tune2fs -l /dev/sda8

For a /home partition, it is probably safe to set the reserved fraction to zero:

sudo tune2fs -m 0 /dev/sda8

Which should make an additional ~5GB available.

6
  • 1
    Yep... that's what I've been looking for. Thanks Commented Jan 30, 2013 at 15:13
  • 1
    In my case it freed around 22 GB! Commented Oct 29, 2018 at 14:42
  • 1
    is its safe to set reserved size to 0 on a mounted partition ( not / )? Because I accidentally did just that
    – Mah35h
    Commented Dec 1, 2021 at 14:58
  • This solved my black screen issue after restoring with aptik Commented May 27, 2022 at 12:53
  • @PhilippeDelteil According to man tune2fs, "Normally, the default percentage of reserved blocks is 5%." Commented May 6, 2023 at 9:26
13

This question is really about interpreting the output of the df command, which is famously confusing and if you Google it, you'll see many questions about df.

How to interpret df's output

Size in df's results are inclusive of the 5% reserved space @chronitis told you about. This is the total absolute space. This number will approximate the size shown in the results of fdisk -l for the partition which you're reviewing in the df results.

Used+Avail provides the total effective space and excludes the 5% reserved space. This is the space you can actually work with.

So nothing is missing. The disparity between Size and Used+Avail totals in df's output represents the 5% reserved space.

Free space not accounted for in df's output

If you're scratching your head thinking "But I deleted that file(s), why can't I see the additional space in df?!?", here's why:

If you delete a large file(s) but the process for it hasn't been terminated, this "free" space won't be reflected in the results of df.

sudo lsof +L1 will identify deleted files still showing a PID.

7

By default, ext2/3/4 filesystems reserve 5% of the space to be useable only by the superuser, root.

There is also some space reserved for metadata, that is necessary for the file system, for examples inodes and the journal.

You can find some details in the manual

man mkfs.ext4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .