How to fully detach ZFS subvol mount point from container?

Stephen Hill

Active Member
Aug 3, 2017
4
0
41
39
Hello

I have a container which has two disks, a small root disk, and a large ZFS subvolume as mp0.

1684837375439.png

What is the correct procedure for detaching the ZFS subvolume, so that I could delete or restore the container without loosing the subvolume.

I tried to do this recently, I detached the ZFS volume and then restored a backup of the root disk. I assumed because I had detached the ZFS volume that it would be safe. I was horrified to find out that Proxmox had deleted the volume - even though it was detached.
(I only backup the root disk using Proxmox, the contents of the ZFS volume is backed up separately)

So, for future reference, I would like to know how to do it correctly.

Many Thanks
Stephen
 
Forgive me, but this doesn't appear to answer my question. First, I'm using ZFS not a mounted directory. Second, can you explain how this would stop Proxmox from deleting the ZFS volume? Finally, how do I correctly and safely detach said volume?
Sorry, my mistake. I though you wanted to bind mount (any type of) filesystem, which is not part of the container, inside the container and prevent Proxmox from removing it when removing the container or restoring the container from backup.
I did not realize you are using a virtual disk as the volume. Proxmox will keep messing with that and I don't know a way around that. Instead I advise you to create your own ZFS volume, mount/import (and unmount/export) it on the host and then use the way I referred to bind-mount it in the container. Then Proxmox does no know about the volume and it won't be deleted (but also cannot be backed up).

Maybe there are other or betters ways. I thought people in the other thread I linked were having the same or at least a very similar issue. I can't claim it is a perfect fit for your issue but I do think something like it, using a separate filesystem instead of a virtual disk managed by Proxmox and using lxc.mount instead of a mountpoint, can prevent Proxmox from interfering like it does now.
 
Just brain storming here, but would it be possible to rename the volume outside of Proxmox (root terminal), perform what ever delete/restore tasks I wanted to do on the container, and then rename/reattach the ZFS volume to the container?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!