How to move storage mount point to bind mount point?

Sasha

Well-Known Member
Oct 18, 2018
116
3
58
Kazahstan
Hi, guys.
On local-zfs PVE-storage i created LXC 101 and storage mount point, so zfs list shows

Code:
NAME                           USED  AVAIL     REFER  MOUNTPOINT
...
rpool/data                     430G  1.14T      112K  /rpool/data
rpool/data/subvol-101-disk-0  4.71G  95.3G     4.71G  /rpool/data/subvol-101-disk-0
rpool/data/subvol-101-disk-1   422G   278G      422G  /rpool/data/subvol-101-disk-1
...

and pvesm list local-zfs shows

Code:
Volid                       Format  Type              Size VMID
...
local-zfs:subvol-101-disk-0 subvol  rootdir   107374182400 101
local-zfs:subvol-101-disk-1 subvol  rootdir   751619276800 101
...

So ZFS file system local-zfs:subvol-101-disk-1 was automatically created and connected to PVE-storage local-zfs as always.
But i need bind mount in LXC 101 connected to host /rpool/data/subvol-101-disk-1.

So i deleted (PM gui) storage mount point from LXC 101 so ZFS file system local-zfs:subvol-101-disk-1 became unusable BUT is still displayed in PVE-menu CT-Resource and in Host-local-zfs-CT Volumes (pvesm list local-zfs).

How i can completely disconnect that ZFS file system from PVE-storage without deleting to use its mount /rpool/data/subvol-101-disk-1 for bind mount point of LXC 101?
 
A bit late, but as i just gone through exactly the same question, here is what i did:

- shut down the container

- zfs rename rpool/data/subvol-101-disk-1 rpool/<whatever> to rename the zfs subvolume - as far as i understand, if you include subvol-101 in the new name, that is how PVE will determine that the subvolume belongs to the container. Haven't tested that though, as i didn't want that anyway ;)

- edit /etc/pve/lxc/101.conf and replace the current mp0 (probably) with mp0: /rpool/<yourpath>,mp=/<your mountpoint in the container>. Notice the /rpool instead of just rpool - that differentiates mounts from bind mounts.