20091020 notes on filesystem layout - plembo/onemoretech GitHub Wiki

title: Notes on filesystem layout link: https://onemoretech.wordpress.com/2009/10/20/notes-on-filesystem-layout/ author: lembobro description: post_id: 225 created: 2009/10/20 13:36:35 created_gmt: 2009/10/20 13:36:35 comment_status: open post_name: notes-on-filesystem-layout status: publish post_type: post

Notes on filesystem layout

Had to rebuild the home workstation last night. In fact the job isn’t done yet, as updates are still loading. The thing that really burns me about that is CentOS 5.4 is on the verge of release, but not quite ready yet.

Once again I was faced with the decision of whether to leave the partitions on the primary disk relatively “fat” (making “/” tens of gigabytes) or to go back to the traditionally spare partitioning schema I “grew up” on. The advantage of making a huge root partition with maybe a small /boot and maybe a big /home are obvious. There’s little likelihood you’ll have to adjust partition sizes as things grow in unexpected ways. The disadvantages are twofold: (1) Rebuilds can take longer when most of your partitions have to be backed up and then blown away; and (2) When something goes wrong fsck can take forever to complete.

Below is a comparison of each kind of partitioning scheme. Both assume around 130 - 160G of primary disk. I always recommend leaving at least 10G free space for “expansion”, no matter what (if only I took my own advice most of the time!).

Traditional, “lean”, partitioning:

/boot 200M

/ 2045M (2G)

/usr 6192M (6G)

/opt 2045M (2G)

/home 4095M (4G)

/var 3192M (3G)

/tmp 2045M (2G)

/data 120000M (120G)

swap 4045M (4G)

“Fat” partitioning:

/boot 200M

/ 10000M (10G)

/home 8192M (8G)

/var 8192M (8G)

/tmp 4045M (4G)

/data 100000M (100G)

swap 2045M (2G)

There’s nothing magical about these partition sizes. A busy web server might actually warrant separate, huge, /tmp and /var, partitions. This is because there typically are lots of temp files getting created all the time in /tmp — only outstripped by the log data that gets generated in /var to keep track of what’s going on. A test machine like my home workstation might not need as much /tmp space, but still warrant a big /var for package cache and application data. For a personal workstation you could just as easily made a huge /home partition and dispensed with /data entirely. Notice I reduced swap to 2G in the second example. That’s mostly because on most Linux workstation systems swap is so little used. With commodity hardware, it’s a good thing too.. At commodity prices if you need more memory, buy RAM.

If you do go with the lean scheme, be prepared to do some resizing down the road. On my system, for example, I had to expand /home to 8G almost as soon as I had things back up and running: my recommendation is to use the very excellent GParted Live CD for such work. In my case a modified “lean” scheme works best, because the home workstation doubles as a test server.

Updated 1/7/2011, with the O/S now at CentOS 5.5:

Here’s a snapshot of my actual first disk:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             3.9G  767M  3.0G  21% /
/dev/sda7             106G  188M  101G   1% /data
/dev/sda8             4.0G   88M  3.7G   3% /tmp
/dev/sda5             7.8G  4.2G  3.2G  57% /home
/dev/sda3             6.8G  1.6G  4.9G  25% /var
/dev/sda1             190M   21M  161M  12% /boot
/dev/sda9             4.0G  773M  3.0G  21% /opt
/dev/sda10             10G  5.7G  3.9G  60% /usr

Swap on my system is 4G (mostly to accommodate the requirements of any memory hungry Java apps that I might be testing).

Copyright 2004-2019 Phil Lembo