Wiebe was looking over my shoulder while I was running df to check the disk space that was still available on my Lenovo ThinkPad:
# df -h /dev/sda2 Filesystem Size Used Avail Use% Mounted on /dev/sda2 90G 79G 7.3G 92% /
He noticed that there was a huge gap between the total space (79 used + 7.3 available = 88.3) and the actual size of the file system. According to him this was due to the reserved block count, which is set to five percent by default in ext2 and ext3 file systems—clearly a legacy from a time where disks were smaller.
# dumpe2fs /dev/sda2|grep -i 'reserved block count' dumpe2fs 1.40.8 (13-Mar-2008) Reserved block count: 1196559 # dumpe2fs /dev/sda2|grep 'Block count' dumpe2fs 1.40.8 (13-Mar-2008) Block count: 23931180 # echo 'scale = 2; 1196559 / 23931180'|bc .05
I changed the reserved block count with tune2fs:
# tune2fs -m 1 /dev/sda2 tune2fs 1.40.8 (13-Mar-2008) Setting reserved blocks percentage to 1% (239311 blocks)
# dumpe2fs /dev/sda2|grep -i 'reserved block count' dumpe2fs 1.40.8 (13-Mar-2008) Reserved block count: 239311
# df -h /dev/sda2 Filesystem Size Used Avail Use% Mounted on /dev/sda2 90G 79G 11G 88% /
Now, the reserved blocks take up roughly 934 MiB; I’ve freed 3.7 GiB with this little file system tweak. 🙂
Update 14 nov 2010: I finally fixed two errors in my final calculations spotted by Den. He noticed that the numbers (700 MiB and 13 GiB) were wrong. Thanks, Den!
Recent Comments