Default reserved space is too much these days
Once upon a time, adequate space was a rare thing to come across, and so many UNIX and UNIX-like systems set aside an allocation of space reserved for root when a filesystem is formatted. This usually is done as a percentage of the filesystem—by default with ext{2,3,4} file systems, that is 5%. This tends to be a lot of space when you have very large partitions (by original UNIX standards, that is). For example, a 100 GiB partition loses 5 GiB to this reserved space. That’s an awful lot.
I’ve never had a use for a *huge* amount of this type of space on every partition on a system. Just enough “elbow room” to work with is fine for me, and lets more data be stored. So, for partitions larger than 2 GiB or so (which is just about the case these days for any machine, with the possible exception of a boot partition), there is an awful lot of space that just isn’t used. Now, this is the number that works for me and most of my systems, so of course some people may want more space (and some may want less). I cut the reserved space to 100 MiB, which frees up a lot of space on my filesystems. Here is the effect of doing it on my server:
Tuesday, 2009-Mar-03 at 17:35:04 - mbt@allspice - Linux v2.6.28.7
Debian Lenny:[0-23/167-0]:/srv> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 5.5G 859M 4.5G 16% /
tmpfs 503M 0 503M 0% /lib/init/rw
udev 10M 116K 9.9M 2% /dev
tmpfs 503M 0 503M 0% /dev/shm
/dev/mapper/lvmsys-opt
4.0G 502M 3.3G 14% /opt
/dev/mapper/lvmsys-home
99G 1.9G 92G 3% /home
/dev/mapper/lvmsys-srv.db.mysql
4.0G 136M 3.7G 4% /srv/db/mysql
/dev/mapper/lvmsys-srv.db.postgres
4.0G 136M 3.7G 4% /srv/db/postgres
/dev/mapper/lvmsys-srv.vcs
4.0G 136M 3.7G 4% /srv/vcs
/dev/mapper/lvmsys-srv.vcs--mirror
20G 172M 19G 1% /srv/vcs-mirror
/dev/mapper/lvmsys-srv.www
4.0G 136M 3.7G 4% /srv/www
Tuesday, 2009-Mar-03 at 17:35:09 - mbt@allspice - Linux v2.6.28.7
Debian Lenny:[0-24/168-0]:/srv> for i in /dev/lvmsys/{home,opt,srv.db.mysql,srv.db.postgres,srv.vcs,srv.vcs-mirror,srv.www}; do sudo tune2fs -r 25600 $i ; done
tune2fs 1.41.3 (12-Oct-2008)
Setting reserved blocks count to 25600
tune2fs 1.41.3 (12-Oct-2008)
Setting reserved blocks count to 25600
tune2fs 1.41.3 (12-Oct-2008)
Setting reserved blocks count to 25600
tune2fs 1.41.3 (12-Oct-2008)
Setting reserved blocks count to 25600
tune2fs 1.41.3 (12-Oct-2008)
Setting reserved blocks count to 25600
tune2fs 1.41.3 (12-Oct-2008)
Setting reserved blocks count to 25600
tune2fs 1.41.3 (12-Oct-2008)
Setting reserved blocks count to 25600
Tuesday, 2009-Mar-03 at 17:35:25 - mbt@allspice - Linux v2.6.28.7
Debian Lenny:[0-25/169-0]:/srv> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 5.5G 859M 4.5G 16% /
tmpfs 503M 0 503M 0% /lib/init/rw
udev 10M 116K 9.9M 2% /dev
tmpfs 503M 0 503M 0% /dev/shm
/dev/mapper/lvmsys-opt
4.0G 502M 3.4G 13% /opt
/dev/mapper/lvmsys-home
99G 1.9G 97G 2% /home
/dev/mapper/lvmsys-srv.db.mysql
4.0G 136M 3.8G 4% /srv/db/mysql
/dev/mapper/lvmsys-srv.db.postgres
4.0G 136M 3.8G 4% /srv/db/postgres
/dev/mapper/lvmsys-srv.vcs
4.0G 136M 3.8G 4% /srv/vcs
/dev/mapper/lvmsys-srv.vcs--mirror
20G 172M 20G 1% /srv/vcs-mirror
/dev/mapper/lvmsys-srv.www
4.0G 136M 3.8G 4% /srv/www
Tuesday, 2009-Mar-03 at 17:35:27 - mbt@allspice - Linux v2.6.28.7
Debian Lenny:[0-26/170-0]:/srv>
That’s quite a noticeable improvement.
The number 25600 is the number of blocks to reserve; to get 100MiB of reserved space, I held 25,600 blocks (4KiB in size on these filesystems) for root. The percentage really only makes sense if the filesystem size is small, since you’d obviously not want a 100 MiB reservation for a filesystem that is under 2 GiB or less in size, since you’d be consuming a very large portion of the filesystem for a reservation. The point of the reserved space is to give root some wiggle room when the users fill up the drive, and 100 MiB is enough to do that with. Maybe even less is enough.
Joseph 4th March 2009
Very detailed information! It is a bit difficult for me but I will try to understand!