'qm set' equivalent pct command to attach existing zfs filesystem as mountpoint in container? (solved)

nomizfs

Renowned Member
Jan 7, 2015
40
7
73
Hello, i use encrypted zvol's for my desktop vm's by manually creating them, and then linking them to the VM's using the qm set command, for example:

Code:
qm set 102 -scsi0 /dev/zvol/zpool_800G/debian-root,discard=on,ssd=1,cache=directsync,iothread=1

but is there an equivalent command for containers?

I just tried creating a mountpoint in GUI for a container, then detaching it, then destroying it, and then manually creating an encrypted filesystem:

Code:
zfs create -o refquota=8G -o encryption=on -o keylocation=prompt -o keyformat=passphrase zpool_800G/subvol-112-disk-1

UPDATE: while writing this post, i figured it out.

If that encrypted filesystem exists, then i can attach it as a mountpoint simply by doing:

Code:
pct set 112 -mp0 zpool_800G:subvol-112-disk-1,mp=/test

and it works. After shutting down the container it first needs to be unmounted with zfs unmount zpool_800G/subvol-112-disk-1, before i can unload the key.
Before starting the container simply loading the key suffices, no need to manually mount it again, it seems proxmox will do that automatically.

Sorry, this post started out as a question, but turned out to be a short guide instead.
 
thanks for the info,
I was looking for how to do exactly what you described.


the post-stop umount you could probably automate, using a simple hookscript that you attach to the container
post-stop
umount the filesystem
 
  • Like
Reactions: nomizfs

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!