You're probably familiar with tune2fs command, it's great for reporting filesystem layout and configuration options. It's also helpful when you want to free up some of the reserved space.
Reserved Space in Unix/Linux Filesystems
Reserved space is one of the more mysterious things in Linux/Unix filesystems. A rather old tradition, it is simply a practice of automatically reserving some filesystem space for system (superuser) use. When you're formatting a new filesytem, it automatically reserves 5% of space for superuser access – meaning regular users and processes won't be able to use this space (filesystem will report to be 100% full), but root user can still write and troubleshoot.
Reserved Space meant a lot more convenience when hard disks and filesystems were small – about 20 years ago your / or /var filesystem could be 1GB in total, and this meant it was absolutely crucial to reserve some space so that regular users could not cause an outage by generating some temporary file and filling up a key filesystem. These days sizes of filesystem are vastly larger and this means two things:
- You probably don't benefit from reserved space as much as someone used to
- You may well never even know you had space reserved because you simply don't run out of space
Here's how this would look:
[email protected]:/storage # df -h /storage Filesystem Size Used Avail Use% Mounted on /dev/nvme0n1p8 95G 90G 232M 100% /storage
Doesn't quite add up, does it? It's a 95GB filesystem with only 90GB used, yet filesystem is 100% full.
Change Reserved Space Percentage with tune2fs
Let's use tune2fs command to reduce the percentage of reserved space (-m 1 means set reserve to 1% of total capacity):
[email protected]:/storage # tune2fs -m 1 /dev/nvme0n1p8 tune2fs 1.44.6 (5-Mar-2019) Setting reserved blocks percentage to 1% (254279 blocks)
… and enjoy the results:
[email protected]:/storage # df -h /storage Filesystem Size Used Avail Use% Mounted on /dev/nvme0n1p8 95G 90G 4.2G 96% /storage
That's it for today, hope you learned something new!
- Advanced Unix commands
- tune2fs command
- Unix Commands
- Basic Unix commands
- How To: change filesystem label with tune2fs
Leave a Reply