I'd like to set up an lxc container on an ubuntu host with multiple back-end disks. At least two:

/opt, maybe

Is there a way to, in one lxc-setup command, to accomplish this? Below is what I"ve curently been using to create containers:

sudo lxc-create -t ubuntu -n ubuntu32 -B lvm --vgname=lxcDG --lvname=lv-lxc-ubuntu32 \
    --fstype=ext4 --fssize=5G -- -a i386

I'm having need similar to your's.

I think I found a solution but not with a single command:

Assuming your lxc container already exists and is located in /var/lib/lxc/mycontainer/, you'll find a file named fstab, probably empty. Assuming you created a logical volume named lv, in the volume group vg0, ext3 formated, and you want to use it in your container. Add the following line:

/dev/vg0/lv mnt ext3 defaults 0 0

Try to start your container:

lxc-start -n mycontainer -F

Log in and check you see and access some files contained in lv (if not, mount your volume in the host, create a file and unmount it, before starting the container).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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