-2

I'm building a few virtual machines under KVM where the base system will be an image (haven't decided specifically which format yet), and all of the remaining system files will be other partitions mounted from a distributed file system.

For instance, / will be part of the main image, but /home will be mounted from elsewhere. My goal is to keep the base system image as small as possible and thus to have as much of the system not be a part of the root partition.

So my question is: Which directories in Linux must be part of the root file system? For instance, I assume that directories such as /etc and /sbin must, because that's where the utilities are that allow booting the system and mounting other partitions. But /opt can certainly be on a different partition.

In case it matters, the systems I'm building will either be Ubuntu Server 12.04 or perhaps 14.04 if I wait until it comes out before producing and deploying these.

Nick Coons
  • 345
  • 4
  • 16

3 Answers3

1

Things haven't changed that much since the 90s. Typically, /etc /bin /sbin /lib /lib64 is everything you need on /. You can get away with far less that 1GB (I have 256M on a few CentOS vm's with plenty of room to spare)

quadruplebucky
  • 5,041
  • 18
  • 23
1

I recommend you not try a design like this unless you are using a very recent Linux system which has completed the /usr move. You'll run into a variety of issues otherwise, the primary one being that packaged binaries are split between the shared filesystem and the unique per-machine filesystems. This completely negates any benefit you may have been aiming for by sharing a filesystem.

In any case, on a system post /usr move, the root filesystem pretty much holds mountpoints, symlinks to mountpoints and /etc and is otherwise empty; it can therefore be trivially small. Such a system contains no packaged binaries at all; everything is under /usr.

(This works on modern Linux systems because of the initramfs, which does the work of mounting filesystems necessary for booting.)

Notably, Ubuntu has not done the /usr move and it probably won't happen until after systemd goes in. It will miss 14.04 LTS and I wouldn't reasonably expect it until 16.04 LTS, if Ubuntu lives that long. I'm not sure why you're set on Ubuntu, but I would seriously consider another distribution (and not only for this reason).

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
0

You should take some time to understand the Linux Filesystem Hierarchy Standard.

You could have a partitioning scheme as simple as /boot and / or with many, MANY partitions.

My minimal installations have < 1GB of data in /.

ewwhite
  • 194,921
  • 91
  • 434
  • 799
  • Sorry to not be clear in my question, I've been using *nix since the 90s, so I'm not a newbie. I do understand the information in the link you provided. What I don't know is, what I stated in my question, which directories are required to be part of the root partition and which can be mounted. For instance, `/bin` cannot be outside of the root partition, but `/opt` can. The wiki page you linked to doesn't seem to answer this question. – Nick Coons Feb 27 '14 at 05:59
  • Agreed, the Linux FS hierarchy "standard" doesn't have much to say directly to the question unless you pay close attention to the word "essential". – quadruplebucky Feb 27 '14 at 06:37
  • @nickcoons I don't understand why you're complicating the installation process, especially with Ubuntu. If you're familiar with the FHS, then use common sense to determine what's needed. /boot, /var, /usr, /home, /tmp and /opt are commonly separated. But never /lib, /bin, /sbin. – ewwhite Feb 27 '14 at 13:00
  • @ewwhite FHS dictates which directories are needed and what they are used for, not whether or not they must be on the root partition. – Nick Coons Feb 27 '14 at 20:17