[Lxc-users] Proposal for an FHS-compliant default guest filesystem location

Walter Stanish walter.stanish at saffrondigital.com
Fri Oct 29 23:30:56 UTC 2010


Hi all,

I have been playing with LXC on and off for a few months now.  It's
great.  Thanks so much to all developers and the wider user community
for making yet another powerful set of functionality available to the
free world! :)

Now that's out of the way...

One higher-level issue I see at present is that the various
distribution packages and lxc userspace/template scripts seem to have
different concepts of the 'correct' destination for container-related
files.

While /etc/lxc may be a good choice for configuration files, guest
root filesystems may be of considerable size and should definitely
stay away from /etc/

Right now this is not the case.  For example 'lxc-create -t fedora -n
fedora' will create /etc/lxc/fedora/rootfs

To see what 'the right approach' might be, I had a look at the
Filesystem Heirarchy Standard v2.3 (2004) @
http://www.pathname.com/fhs/

Apparently the decision earlier this year to move the template scripts
out of standard binary locations was made against this standard, so it
would seem a good place to seek guidance.
http://lxc.git.sourceforge.net/git/gitweb.cgi?p=lxc/lxc;a=commitdiff_plain;h=c01d62f21b21ba6c2b8b78ab3c2b37cc8f8fd265

Reading the document, it appears that one of the following may be a
better location for guests' root filesystems:
 /srv/lxc
 /var/lxc
 /var/lib/lxc

The reason *not* to use /srv/lxc is the following quote from page 15
of the FHS v2.3 PDF:
 "This setup will differ from host to host.  Therefore, no program
should rely on a specific subdirectory structure of /srv existing or
data necessarily being stored in /srv"

The data should not be placed in /usr ("/usr is shareable, read-only
data" - page 18).

It thus appears that one of the /var/lxc or /var/lib/lxc options appear best:
"/var is specified here in order to make it possible to mount /usr
read-only.  Everything that once went into /usr that is written to
during system operation (as opposed to installation and software
maintenance) must be in /var" (page 30)

Later the FHS states (page 30):
"Applications must generally not add directories to the top level of
/var.  Such directories should only be added if they have some
system-wide implication, and in consultation with the FHS mailing
list"

Therefore I humbly propose:
 - the establishment of /var/lib/lxc as the default top-level
directory for guest filesystems
   (eg: /var/lib/lxc/<guestname>)
 - all use of /etc/lxc/<guestname>/rootfs should be considered deprecated
 - legacy installations may create /etc/lxc/<guestname>/rootfs
symlinks to assist with migration

Thoughts?

- Walter




More information about the lxc-users mailing list