2

I'm using the command df -h to check disk usage on CentOS 6.4. I see an inconsistency with the output.

df -h

look at the line Filesystem: total 490Gb, used 55Gb, and Available 411Gb. What is it mean?

I think that 490 - 55 = 435 ?

jordanm
  • 42,678
Thomas
  • 383
  • You can see this: http://unix.stackexchange.com/questions/25602/why-is-free-space-used-space-total-size-in-df – cuonglm Jan 22 '14 at 05:00
  • @Gnouc I should have done that search before I answered. The one you linked is actually a duplicate as well. – jordanm Jan 22 '14 at 05:04

1 Answers1

3

Some disk space is reserved for the root user, and is not displayed as in the df output. On an ext2/3/4 filesystem, this defaults to 5% of filesystem. This reserved space is important for reducing file fragmentation on the filesystem.

490 * 0.05 = 24.5
490 - (55 + 24) = 411

Also note that when using some -h some precision is lost due to rounding. On an ext2/3/4 filesystem, you can view the reserved block percentage using the tune2fs command. Here is an example from my workstation:

# tune2fs -l /dev/mapper/newvg-root 
tune2fs 1.42.5 (29-Jul-2012)
Filesystem volume name:   <none>
Last mounted on:          /mnt/oldroot
Filesystem UUID:          d41eefc5-60d6-4e18-98e8-d08d9111fbe0
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              3932160
Block count:              15728640
Reserved block count:     786304
Free blocks:              11086596
Free inodes:              3312928
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1020
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Tue Feb  8 16:28:29 2011
Last mount time:          Mon Dec  9 23:28:11 2013
Last write time:          Mon Dec  9 23:48:24 2013
Mount count:              19
Maximum mount count:      20
Last checked:             Tue Sep  3 23:00:06 2013
Check interval:           15552000 (6 months)
Next check after:         Sun Mar  2 22:00:06 2014
Lifetime writes:          375 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      80cf2748-584a-4fe8-ab8c-6abff528c2c2
Journal backup:           inode blocks

In the above output you can see that 786304 are reserved. With the block size of 4096 (default), this is 3220701184 bytes or 3GB reserved. We can also see that this is the approximately the default 5%:

15728640 * 0.05 = 786432
jordanm
  • 42,678