The filesystem ext4 has a feature called block reservation. When you create an ext4 filesystem then 5% of your available space will be reserved for block reservation by default. For an 20GB filesystem it is only 1GB of reserved space. But if you have an 1.5TB filesystem then 5% are about 75GB already. And that is my case. I have a 1.5TB partition with an ext4 filesystem:
# df -h /local/data/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/local-data 1.5T 1.4T 46G 97% /local/data
As you can see only 49GB of space are available and currently I'm really to cheap to buy a new hard disk. So let's take a closer look at the block reservation for this partition:
# tune2fs -l /dev/mapper/local-data | grep -i "block"
...
Reserved block count: 19398656
...
Block size: 4096
...
There are 19398656 reserved blocks with a block size of 4096 byte. When you multiply them and divide the result 3 times by 1024 you'll get the reserved space in GB:
# echo 19398656*4096/1024/1024/1024 | bc
74
74GB is a lot of space for a slow growing archiving file system! Let's reduce the block reservation to 0%:
# tune2fs -m 0 /dev/mapper/local-data
tune2fs 1.42.8 (20-Jun-2013)
Setting reserved blocks percentage to 0% (0 blocks)
And recheck with tune2fs:
# tune2fs -l /dev/mapper/local-data | grep -i "Block"
...
Reserved block count: 0
...
A final look with df clearly indicates that the available space has grown to 120GB:
# df -h /local/data/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/local-data 1.5T 1.4T 120G 92% /local/data
# echo 120-46 | bc
74
Just a note/hint: only reduce the block reservation to 0% for eg. archiving filesystems (your personal music or movie collection). Don't reduce the block reservation to 0% for the root filesystem, special logging file systems or else.
No comments:
Post a Comment