Let me explain the issue first:
I was not able to ‘save’ a file in my ‘home’ directory and it was complaining that, there is NO SPACE,
So, I checked “df” output
[root@humbles-lap home]# df -kh
Filesystem Size Used Avail Use% Mounted on
rootfs 50G 42G 5.6G 89% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 572K 3.9G 1% /dev/shm
tmpfs 3.9G 900K 3.9G 1% /run
/dev/mapper/vg_humbles-lap-lv_root 50G 42G 5.6G 89% /
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs 3.9G 0 3.9G 0% /media
/dev/sda1 485M 80M 380M 18% /boot
/dev/mapper/vg_humbles-lap-lv_home 235G 223G 0 100% /home
Hmmmmm.. pretty confusing .. Isn’t it ?
For those who did n’t figure it out or for those who already know the answer :
I was thinking ‘Used’ and ‘Size’ should match , because 100% (Avail ) has reported:
Obviouly there is some gap .. I mean “235-223” = ~ 12GB.
This is ext4 filesystem .
[root@humbles-lap home]# mount |grep home
/dev/mapper/vg_humbles-lap-lv_home on /home type ext4 (rw,relatime,data=ordered)
Why So ?
if you dont know the answer: It is the space “reserved-for-root”. Ext4 reserves 5% for “root” .
Now, next question is ‘How can i prove it” ?
Lets do ‘stat’ or ‘dumpe2fs’ on the subjected filesystem ..
In below output, look at the count ‘3117465‘.
[root@humbles-lap home]# stat -f /home
File: “/home”
ID: 529de0e89c35a13c Namelen: 255 Type: ext2/ext3
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 61370930 Free: 3117465 Available: 0
Inodes: Total: 15589376 Free: 15350172
[root@humbles-lap home]# dumpe2fs -h /dev/mapper/vg_humbles-lap-lv_home | grep ^Reserved
dumpe2fs 1.41.14 (22-Dec-2010)
Reserved block count: 3117465
Reserved GDT blocks: 1009
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
Ok.. we came to know it is reserved , How can I tune it ?
Use ‘tune2fs’.
List it first using ‘tune2fs -l” command
————-
[root@humbles-lap humble]#
Reserved block count: 3117465
Reserved GDT blocks: 1009
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
[root@humbles-lap humble]#
-m reserved-blocks-percentage
Set the percentage of the filesystem which may only be allocated by privileged processes. Reserving some number of filesystem
blocks for use by privileged processes is done to avoid filesystem fragmentation, and to allow system daemons, such as syslogd(8),
to continue to function correctly after non-privileged processes are prevented from writing to the filesystem. Normally, the
default percentage of reserved blocks is 5%.
Lets remove the restriction using “-m” option:
[root@humbles-lap humble]# tune2fs -m 0 /dev/mapper/vg_humbles-lap-lv_home
tune2fs 1.41.14 (22-Dec-2010)
Setting reserved blocks percentage to 0% (0 blocks)
[root@humbles-lap humble]#
Now, verify it :
[root@humbles-lap humble]# tune2fs -l /dev/mapper/vg_humbles-lap-lv_home|grep Reserved
Reserved block count: 0
Reserved GDT blocks: 1009
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
[root@humbles-lap humble]#
Cooooooool..
[root@humbles-lap humble]# df -kh|grep home
/dev/mapper/vg_humbles-lap-lv_home 235G 223G 12G 95% /home
[root@humbles-lap humble]#
There U go… Hope it helps..