Add a second disk image to a LXC container in Proxmox 4

lxcproxmox

My LXC containers in Proxmox 4 have a root filesystem stored on the host as a RAW disk image stored in :

/var/lib/vz/images/<ct_id>/vm-<ct-id>-disk-1.raw

This folder on the host computer is from an ext4 partition :

/dev/mapper/pve-data on /var/lib/vz type ext4 (rw,relatime,data=ordered)

I would like to attach a second disk image to a LXC container, but I can't find any way of achieving that. All I've managed to do was to bind-mount a folder from my host system to the container, but that's not an option for what I want to do : add a storage volume to my OpenMediaVault container.

Do you know any way (using Proxmox UI or/and CLI) of attaching a second disk image to a LXC container ?

Thanks.

Best Answer

See in below example how I mount an LVM partition from the host inside the guest machine:

execute these steps on the host machine. The number 100 is the id of the guest machine:

vi /var/lib/lxc/100/fstab
/dev/vg0/vm-100-disk-2 var/lib/mysql ext4 noatime 0 0

enable guest based fstab entry:

vi /var/lib/lxc/100/config
lxc.mount = /var/lib/lxc/100/fstab