There's no point in multiple system filesystems any more

October 4, 2015

Over the years I've written a number of things about how I think one should partition up your disk or disks for your system filesystems. Three things have been constant in those successive updates; the sizes of everything has kept growing, the amount I trust things like software RAID and LVM has kept increasing, and the number of separate filesystems has kept shrinking. Today I feel like writing down my current views, which are really simple. To wit, I feel there's no point in having more than /, the root filesystem.

It's been some time since a separate /var or /usr made sense or was even supported. I stubbornly clung to a separate /boot for a long time, but I don't see any point to it any more, so I say make your life simpler by putting it in the root filesystem too. As far as size goes, I like to give the root filesystem 80 to 100 GB of disk space so that I have room for crazy things like saving a copy of every RPM I've ever downloaded, but in today's increasingly SSD-based environment you might want to be more parsimonious. I suspect 50 to 60 GB will cover most everyone.

(If you have lots of disk space available for this purpose, make two identical-sized partitions and use the second as a backup root filesystem during major things like OS version upgrades. My experience with this is that having a backup root filesystem is very reassuring.)

I'm still a very strong proponent of mirrored system disks. While I like LVM in general, I wouldn't put / into an LVM volume; I prefer to reserve LVM volumes entirely for my own data, so I can do crazy things like convert to ZFS without affecting the root filesystem (here's my disk layout for ZFS). This means I use good old fashioned software RAID mirrors on actual partitions (GPT partitions these days). Modern Linux installers make this relatively simple to set up.

As far as the filesystem type for / goes, use something well tested and solid (and with solid GRUB boot support, since /boot is part of it). Today that means ext3 or ext4. If you want to flirt with Btrfs or ZFS on Linux, well, go for it, but you're probably going to need a separate /boot and have all sorts of annoyances (and you're probably reading this entry mostly for amusement value).

My view is that basically every directory that your OS distribution creates is best left alone and unused, and thus should be left on the root filesystem. I'm willing to put a small amount of things in /opt if they insist, but I don't have my own home directory and data in /home; I have a separate directory hierarchy (and separate filesystem) for my actual home directory. The same thing is true for website files, database storage, and so on; I don't accept the stock defaults of various places in /var.

I'm sufficiently old fashioned that I still make a separate swap partition; these days I use 1G or 2GB as the size, which is enough to keep Linux happy without risking death by swapping. I use a software RAID mirror for this too, because why not. More daring people can swap to a file in the root filesystem, although that may be harder to set up during the initial system install.

I have no idea how you want to set up your system filesystem(s) if you want (or have to have) an encrypted root filesystem. Perhaps someday I'll have to worry about that, but not right now.

(I have no particular opinions on what you should do on a laptop where you have a single disk and that's it. On my casual usage work laptop, I think I just made everything a single filesystem on the single disk and shrugged about my home directory being in /home and sharing space with the root filesystem.)

Comments on this page:

Hmm. I have had a different experience. I understand your point, but it sounds like you haven't worked in shared hosting environments. Working for an ISP who offers hosting products, having /var/ on a separate mount is absolutely critical. Also, due to the hosting aspect, we need /home/ on its own separate mount as well, which is actually NFS mounted from a NetApp. Basically, in the "enterprise", I find separate /var/, /home/, and even /usr/ mount points to be critical to operation.

With that said, I don't do swap in the enterprise. If I'm running low on RAM, where swap would be needed, I get more RAM. I'll deploy "zram" and "zswap" however, where there are compressed swap spaces in RAM, but I won't do disk-based swap devices. I just don't see the need.

With home systems, however, I'm 100% behind you. I don't do separate partitions or mount points, unless I want ZFS for /home/ and ext4 for everything else. For home systems, also, I'm usually limited by budget, so installing more RAM may not be feasible, so I'll put down a 1GB swap partition on disk. But, I also have SSDs where I can put that swap, and I keep it cleaned out with regularity, so it's not an issue.

By cks at 2015-10-05 12:40:39:

For Linux specifically, separate /usr and I believe separate /var is explicitly unsupported on any systemd-using distribution. With Ubuntu following Debian's lead, this will soon include almost all major distros (RHEL/CentOS 7 is systemd based, new Debian is systemd based, and so the next Ubuntu LTS will be systemd based). I believe that you can still push /home into a separate filesystem if you want to, but I don't see any reason to use /home at all in a large-scale environment; if you have lots of logins with lots of home directories, you're unlikely to want them all piled into a single directory.

(Locally we have 126 separate home directory filesystems. Needless to say, none of them are called '/home'.)

As far as swap goes, Linux kernels at least used to freak out under memory pressure if you had no swap space at all. Putting in a small swap area of some sort (partition, file, etc) was (and is) a precautionary measure against such crippling events.

It is unfortunate that the logs in /var are basically forced to consume space in the root filesystem. In large scale environments you have two workarounds: shipping logs into some other log handling environment (eg Logstash et al) and configuring programs (possibly including your syslog daemon) to write them to a different location. Since a large scale environment is unlikely to want to reuse the standard configuration files for eg Apache, the latter isn't much of a burden in my opinion.

Actually, now that I am a bit more careful, "/var/" itself isn't separately mounted, but "/var/www/vhosts/", "/var/log/", and many other subdirs under "/var/" are mounted. Same with "/home/". We have "/home/users/" NFS mounted to many hundreds of systems. Further with "/usr/", where nested dirs are separately mounted, but the root itself isn't.

By John Wiersba at 2015-10-06 00:44:09:

Chris, I agree with your philosophy here. My machines have encrypted everything (except boot), so boot is a separate partion and everything else is LVM on LUKS. Inside LVM, I have root, swap, and data. The contents of my home directory physically reside under /data. I use symlinks pointing from /home/$ME/* to the locations under /data where those pieces actually live.

Regarding systemd, the only requirement for a separate /usr is that it must be mounted by the initrd/initramfs (most distros already have taken care of that). Separate /var is supported in the normal way.

By Anon at 2017-04-19 17:38:53:

What about old(er) computers stuck with BIOS booting? Wasn't the whole seperate /boot/ partially there to appease those systems?

By cks at 2017-04-20 00:25:32:

That's a good question. As far as I know (or can remember), one big motivation for a separate /boot wasn't just BIOS booting, it was machines where the BIOS couldn't access the whole disk. Rather than squeeze your entire root filesystem down into what the BIOS could access, you just put a small /boot in that space and left your root filesystem free to be as big as you wanted and wherever on the disk you wanted.

Modern machines don't have this problem and haven't for a long time (the fix apparently dates from 2003), so this isn't a real concern any more.

Written on 04 October 2015.
« There are two approaches to disaster recovery plans
I don't trust Linux distributions to leave directories alone »

Page tools: View Source, View Normal, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sun Oct 4 01:24:49 2015
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.