Normally when a partition fills up, you remove some files, freeing up some space and watch your disk usage drop in
The first time recently I ran into a situation where that wasn’t the case. I had filled up my root partition and after removing some files and moving some others to another partition I noticed no change in my output of
Applications were crashing since they couldn’t write to the partition but I knew I had removed at least a few GB’s worth of data. What gives?
After some frantic googling I stumbled upon something I hadn’t heard of before, known as “Reserved blocks”. Paraphrasing the man page on tune2fs, Reserved blocks are a set of filesystem blocks set aside for use by privileged processes to avoid fragmentation as well as allow system daemons to function after all available disk space has been used up. By default the filesystem sets aside 5% of the filesystem during formatting for use in reserved blocks. If you have a large hard drive, 5% may be a bit much. You can adjust this amount with the command
tune2fs -mX /dev/sda1
where X is the percentage you wish to change to and /dev/sda1 is the partition you wish to modify. In order to get out of the hole I dug myself, I used the command
tune2fs -r /dev/sda1
to reset the block count to 0 and thus giving me back my space I had freed up. Be sure that you have freed up space before running this command, as the reason reserved blocks exist is so in the instance when you have completely filled up your partition, you will still be able to run important daemons and commands without them crashing.
Maybe I will finally add some monitoring to my own desktop to prevent this from happening to me. So far I’ve been bitten by this twice, I noticed each time when pidgin began crashing and firefox wasn’t saving any cookies when logging into any sites.