In this lesson, you will learn how to configure reserved blocks on your filesystem to prevent system crashes when disk space runs low.
The Concept of Reserved Blocks
When a Linux filesystem (like Ext4) reaches 100% capacity, bad things happen. If a system process needs to write a critical log file or a temporary configuration update and finds no space, the service might crash, or the system might fail to boot. To prevent this, Linux reserves a small percentage of disk space that is strictly off-limits to regular users.
By default, Ext4 reserves 5% of the total filesystem capacity for the root user. This ensures that even if a user accidentally fills up their /home partition, the system has a "safety buffer" to continue logging errors and executing essential maintenance tasks.
Managing Reservations with tune2fs
You can inspect or modify these reserved blocks using the tune2fs utility. Since this directly modifies filesystem metadata, you must run it with elevated privileges.
To see the current reservation percentage for a partition (e.g., /dev/sda1), run:
sudo tune2fs -l /dev/sda1 | grep "Reserved block count"
If you manage a large storage volume—like a 10TB drive—a 5% reservation is excessive, as it locks away 500GB of usable space. You can reduce this to a safer, smaller percentage (such as 1%) using the following command:
sudo tune2fs -m 1 /dev/sda1
In this command, the -m flag specifies the percentage of blocks reserved for the superuser. Setting this to 1% is common for data-heavy partitions where you want to maximize storage while still maintaining a small emergency buffer. For boot or system partitions, it is generally recommended to keep the default 5% to ensure that critical system updates and log rotations always have the breathing room required to succeed.
Understanding these reservations allows you to balance system stability with your specific storage capacity needs, ensuring that your server remains operational even under high disk usage scenarios.
Key Takeaway: Reserved blocks create a crucial safety buffer for the root user, preventing system-wide failures when disk capacity is exhausted.