Reclaim me blocks!

Ever wondered why your filesystems fill up so quickly and why those new discs aren’t as big as advertised? While the latter may have several reasons (measuring units, the metric system or just damn lies), it may also be just an overly precautious default filesystem setting. On Linux, every filesystem gets some 5% of the available blocks reserved for the root user. This way, you can still work on your machine even if you forgot to rotate your log files Changing this default to something more realistic on today’s big hard discs may come with a nice surprises. Here’s my laptops root partition before:

saschpe@minime:~% df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 168G 144G 16G 91% /

Now let’s do a courageous tune2fs changing this to 0.2% (more than enough to be able to login and remove logfiles):
sudo tune2fs -m 0.2 /dev/sda1

And check again:

saschpe@minime:~/download% df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 168G 144G 24G 86% /

How neat, 8 fresh new gigs of storage :-)