Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My root filesystem is full and I'd like to create a container in my home directory, which has a lot of free space. I made a config file like this:


And I'm creating a container like this:

  $ sudo lxc-create -f lxc.conf -t ubuntu -n foo

But it's still filling up /var.

How can I tell lxc to create a container in my home dir?

share|improve this question
up vote 1 down vote accepted

EDIT #2:

Wow, can't believe I missed this:

When first installing lxc (version: 0.8.0~rc1-8+deb7u1) ("apt-get install lxc") it will ask you in what directory you want the containers to go.



Apparently if you install "lxc" from source with the command:

make install --localstatedir=/home

it should allow automatic creation of a VE in the /home directory. This will impact all lxc-* tools.


You need to edit "lxc-create" (for me it's in "/usr/bin"). In that file where it defines "localstatedir" and "lxc_path" you need to change that.

Based on what you want, you would need:


Or possibly:


My setup:


I have just figured this out; it creates the container without any errors, but I have not tested it beyond that. As for the line "LXC_DIRECTORY=" in the config file "/etc/default/lxc", it needs to match the line "lxc_path=" in the file "lxc-create" or it will create a rootfs in two different directories.

So your config file "/etc/default/lxc" would need to read:


and mine reads:


This is of course a workaround, and I do not know the impact this has on other lxc-* tools. They may need to be edited as needed also; perhaps someone else can chime in on how to install lxc with this built into the program.

share|improve this answer
Installing from source with the --localstatedir option did the trick. – Alex Marandon Apr 5 '14 at 8:05
is it possible to set the backing directory on a per container basis? – andresp Dec 14 '14 at 14:13
You can just use the '-P' argument of lxc-create. Other commands as lxc-console and lxc-start accepts it too. I think it is easier than define environment variables. – Eduardo Ramos Jan 29 '15 at 17:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.