3

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.

1 Answers1

0

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
BVB Media
  • 101
  • 1
  • This actually is a wrong way to do this (and it was wrong even in PVE 4). The correct way is described [in the documentation](https://pve.proxmox.com/wiki/Linux_Container#pct_mount_points). Also, if you still have PVE4, upgrade it. – Nikita Kipriyanov Dec 29 '22 at 05:24