Question
Setup
On a Proxmox server I create an LXC container with:
pct create 101 local:vztmpl/centos-8-default_20201210_amd64.tar.xz --features mknod=1,nesting=1,fuse=1 --ostype centos --storage=CTVM --description "centos glusterfs" --hostname thorgluster --password "password" --onboot 1 --net0 name=eth0,bridge=vmbr0 --unprivileged=0
Then can device mount /dev/sdd
into it with:
lxc-device add -n 101 /dev/sdd
and adding the following lines to /etc/pve/lxc/101.conf
so it mounts on reboot (8:48
is from lsblk
):
lxc.cgroup2.devices.allow = b 8:48 rwm
lxc.mount.entry = /dev/sdd /dev/sdd none bind,optional,create=file
Note, I need to device mount not bind mount because I need to be able to run LVM commands on the drives from within the container.
Actual Question
However in the future, /dev/sdd
may change names to /dev/sd[a-z]
according to this post. So how can I deal with this name changing?
Attempted Solutions
- I tried using
/dev/disk/by-id/ata-ST2000DM008-2FR102_ZFL1FYFF
instead of /dev/sdd
but it didn't work.
- I considered creating a permanent device node before mounting with
mknod
following this post but I haven't seen this done anywhere else and don't know if there are any other considerations when using mknod like this.
- This post says the device name is tied to the port it's plugged into. Which would mean all I have to do is put physical labels on the disks and ports themselves.
- I saw somewhere I can mount a virtual hard drive into the container which would avoid this problem but I haven't seen any documentation on how to do this. (edit: I might be able to use a loop device. Looking into this.)
- I tried adding
lvm.external=true
to /etc/pve/lxc/101.conf
but got an error.