You can use lxc-create
to create and initialize a new lvm partition
lxc-create -n <name> -t ubuntu -B lvm --lvname <name> --vgname <vgname> --fssize 5GB
Create a directory mkdir /media/volumes/<name>
and edit the /etc/fstab
by adding:
/dev/vg0/<name> /media/volumes/<name> ext4 defaults 0 1
And run mount -a
to mount the container.
Create the directory inside the container
mkdir -p /media/volumes/<name>/mnt/code
Edit the /var/lib/lxc/<name>/config
and change:
#lxc.rootfs = /dev/vg0/<name>
lxc.rootfs = /media/volumes/<name>
Then add to /var/lib/lxc/<name>/fstab
the following line to automount your code partition inside the container:
/media/volumes/code /media/volumes/<name>/mnt/code none defaults,bind 0 0
Start the container by typing lxc-start -n <name>
Log into the container (user and pass should be ubuntu
) and run a sudo ifconfig
to copy your eth0
ip
Now you can logout.
Edit your /etc/hosts
and add <ip> <name>
. You should be able to do shh ubuntu@<name>