My Linux server is running out of disk space, and so are the external disks I’m using for backing up my data. I have also wanted to make the backup process from internal disks to external disks faster, and while searching the internet for ways to optimise that, I stumbled upon a fast, easy and safe way to gain extra usable disk space. I’m slightly embarrassed that I have only discovered this trick until now.
When an ext2 or ext3 filesystem is created, it sets space aside. To quote from the “man” pages for mkfs.ext2 and mkfs.ext3:
“-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 syslogd(8), to continue to function correctly after non-privileged processes are prevented from writing to the filesystem. The default percentage is 5%.”
My external backup disks have absolutely no need for this reserved space; nevertheless the default filesystem set 5% of it aside for root-owned daemons which will never write to the external disks. This is what df showed for one of my external disks:
Filesystem Size Used Avail Use%
/dev/sde1 459G 433G 3G 100%
So 459-(433+3)=23GB I can’t use, the 23GB are the 5% of 459GB set aside and seemingly lost unless I create a new filesystem and use the “-m” parameter.
Luckily this can be changed on an existing but unmounted filesystem using the tune2fs command. So in my case
"tune2fs -m 0 /dev/sde1"
gave me back the 23GB reserved diskspace on the external disks. On my fileserver, /home sits on three 300GB disks setup in a RAID-5 array and root-owned daemons don’t write to /home. Using
"tune2fs -m 0 /dev/md0"
gave me back almost 28GB diskspace on the /home partition. I can now wait another couple of months before I replace the disks.
The following links are the ones that opened my eyes:
http://boncey.org/2006_11_18_reclaiming_ext3_disk_space
http://ubuntuforums.org/showthread.php?t=215177&page=2