Disk Partitioning: Beyond Guessing How Much Space You Will Need

Disk Partitioning: Beyond Guessing How Much Space You Will Need

Robbert Haarman


Posted by inglorion
at 2012-12-05 22:13:25

One of the annoyances of system administration is disk partitioning. Sure, you could just put everything in one large partition. However, if you do that, you lose some nice features. You can't have some things shared and read/write and other things local or read-only. And if you do a clean reinstall of the operating system, you will also wipe out your data.

To add some flexibility, experienced system administrators like to partition the available space and store different kinds of files in different partitions. For example, /, /home, and /var may go in different partitions. Or maybe the OS goes on C:, the applications on D:, and user data on E:. This allows you to perform a new operating system installation without wiping out user data, sharing user data among machines, etc.

One of the difficulties in partitioning is deciding how large the partitions should be. How is the system going to be used? If a lot of applications are going to be installed, /usr needs to be large. Maybe the next version of the operating system will need a larger / or C:. Or perhaps we will host a large database in /var. In general, you want to allocate as much space as possible to user data, but not so much that you run out of space in the other partitions.

Here is an idea: Instead of allocating partitions of fixed size, give every partition a guaranteed amount of space, and have a pool of available space to be used by partitions as needed. For full flexibility, set the guaranteed space for each partition to 0; if you feel you need some guaranteed amount of space, set it to that. Now, partitions can grow and shrink as needed, without needing a lot of sysadmin time to make that happen.

Technologies like Linux's Logical Volume Manager and resizable filesystems get us most of the way there. LVM allows the creation of physical volumes, which consist of one or more disks or partitions. Logical volumes can then be created in the physical volumes, after which the logical volumes can be used as one would normally use partitions. The logical volumes can be grown and shrunk, and, combined with a resizable filesystem, this means that the decision of how large to make the logical volume does not have to be perfect ahead of time.

My suggestion goes one step further. While LVM allows the system administrator to grow logical volumes and filesystems by running commands, make it automatic. Grow filesystems as needed and shrink them as possible, keeping to the configured guaranteed minimum allocations. Is there any system that implements this?