When recently an rsync backup failed due to a full destination drive I had a closer look at the ext4 formatted partition and noticed that despite the disk being reported as full, 50 GB were unused. While this was not the reason for rsync to fail, I nevertheless wanted the 50 GB back.
Before continuing the story about the missing 50 GB just let me say that the rsync backup failed in the first place because rsync copies before it deletes files on the target drive that have been deleted or moved. In my case I moved a lot of files on a disk filled by 85% and thus rsync wanted to put a lot more data on the target drive than it could hold before deleting the files that no longer exist on the source drive.
Now back to the missing 50 GB. It turns out that ext4 by default reserves 5% of the disk capacity for higher priority system tasks (such as logging). That makes sense for system partitions and the percentage might have made sense when disks were significantly smaller than they are today. On 1 TB drives that are only used for backup purposes, reserving 50 GB for nothing is a bit of a waste.
But there’s help because it’s possible to reduce the amount of reserved space with a simple command. Here’s an example that reduces the percentage of reserved space on my backup drive from 5% (50 GB) down to 0.025%:
sudo tune2fs -m 0.025 /dev/sdb1 #Check with the following command before and after to see the changes: sudo tune2fs -l /dev/sdb1
You can see the difference by looking at the amount of free space on your disks with ‘df’ before and after the command. On my system I had to wait a few seconds before the changes were made. Kudos to Jürgen (in German) and Mattias (in English) for writing about this before me!