Category Archives: file systems

As almost everyone knows, your linux filesystem sets aside a portion of the free space as “reserved”. This is 5% of the drive space, by default.

[root@pabu ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/disk1 931G 166G 719G 19% /home/disk1

If you do the math there, 166+719= 885GB. That means the file system is reserving 46GB. This 5% reservation made a lot more sense when hard drives were 120MB than when we are looking at TB or higher file systems.

Fortunately, it is fairly easy to change. If I want to modify it to be 2% rather than 5%, I just do:

[root@pabu ~]# tune2fs -m 2 /dev/mapper/disk1
tune2fs 1.41.14 (22-Dec-2010)
Setting reserved blocks percentage to 2% (4883788 blocks)
[root@pabu ~]#

And, tadah!

[root@pabu ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/disk1 931G 166G 747G 19% /home/disk1

Now I am getting 913GB of my drive, rather than 885.

I would caution you to be careful on how you tweak this. I would never set 0%. Ever. However, setting it to 1-2% on drives, depending on what they are doing (and giving consideration for how large a buffer that provides you for when you do eventually fill that drive) will most likely help you recover from a “my file system says it is 100% full but I can see there is still 50GB there!” issues.

Category: file systems

To add a new tmpfs mount in a specific location:

mkdir -p /path/to/directory/
mount -t tmpfs -o size=512M,mode=0744 tmpfs /path/to/directory

and then add the following to /etc/fstab:

tmpfs /path/to/directory tmpfs size=512M,mode=0777 0 0

The potential returns this can give something like your session (if you’re still using files and not, say, memcache) or cache files is pretty significant. As always, test in your own environment before rolling out into production. And in case you weren’t aware, a reboot will wipe the contents of that folder…after all, it is a ram disk, not actual file storage.

To grow the size of an existing tmpfs:

mount -o remount,size=2G /path/to/directory

And don’t forget to modify /etc/fstab if you want it to be permanent!

Category: file systems, linux


gives good tech
Kale is one of the smartest people I know

Racker Hacker
Major is always good for leet deetz