Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This question already has an answer here:

I have tried different commands to see sizes of partitions and space used/left and it seems that they always differ in their results.

Here is my space used/left with from the command df -h:

Size  Used Avail Use% Mounted on
395G  355G   21G  95% /home

Notice that used and availabe only add up to 376G but size is 395G

share|improve this question

marked as duplicate by Ramesh, Patrick, Braiam, jasonwryan, slm Jul 3 at 8:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

2 Answers 2

up vote 3 down vote accepted

By default, a linux filesystem reserves 5% of the space for root (the user) usage and maintenance. If the device was 100% full, you couldn't even create the temporary files necessary to allow a user to log in... like perhaps.... root!

Total space:  395.00G  (from your example)
   minus 5%:   19.75G  (reserved space)
============  =======
 User space:  375.25G  (Available to users)

 Used space:  355.00G  (from your example)
Avail space:   21.00G
============  =======
      Total:  376.00G  (equals 'User Space' from above)

Since everything's being rounded due to the use of the -h (human sizes) option, these values are essentially equal.

For a filesystem holding a running linux system, you want SOME space reserved, 5% used to be a good value when disks were much (much!) smaller than today. 1% would be better today, and it's still overkill.

Filesystems used as storage can be formatted/setup with 0% reserved space if you wish, no harm there. It's the 'running system' filesystems that need some space.

During the format, you can specify how much space to reserve (in percentage), by using the -m option:

mkfs.ext4 -m 1 /dev/sdz3

(From the man page)

    -m reserved-blocks-percentage
           Specify the percentage of the filesystem blocks reserved for the super-user. This avoids fragmentation, and allows root-owned daemons, such as sys‐
           logd(8), to continue to function correctly after non-privileged processes are prevented from writing to the filesystem.  The default percentage is 5%.

You can also use tune2fs to adjust the reserved percentage on a filesystem after it's been formatted: (also -m option!)

 tune2fs -m 1 /dev/sdz2

Again, please don't set -m to 0 on a filesystem which holds an operating system, you may never encounter any problems, but if your drive fills up, it'll bite you because you can't even log in to fix things. (You'd need a live/rescue cd/usb-stick to fix it!)

Hope this helps.

share|improve this answer
add comment

376 / 395 =~ 0.95. So you are missing approximately 5% of your disk. That sounds like the default value of disk space reserved by the system for system logs etc.

You can find out by running

tunefs -l

which will show you what your reserved blocks percentage is.

You can then retune your file system using

tunefs -m

See the man page for tunefs for more detail.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.