Pvesm and multiple content types

dominikp

Member
Aug 28, 2018
36
3
13
38
Either im blind or this is not clarified in pvesm manual.
I want to add storage with pvesm and specify content for it. But i dont know should they be added with set one by one, or listed in add command? If so then what kind of list should be - strings spearated by commas, dividers or what?
And how to remove some type from storage?
Code:
pvesm add dir mystorage --path /zfspool/dataset --content iso,image,backup
 
yes, comma-separated list works. if you later want to updated the storage definition, you'd use 'pvesm set', e.g.: pvesm set mystorage --content iso,image
 
OK, thanks!
Heres my code which mounts encrypted dataset at boot. A little bit shame that this is not managed by gui.

Code:
#!/bin/bash
/usr/bin/mount /mnt/secret #nfs share with key
/usr/sbin/zfs load-key -a
if [ $(mount | grep /zfsraid0/encrypted) ]; then
    echo "Zfs already mounted"
    exit 0
else
    pvesm remove encrypted
    rm -rf /zfsraid0/encrypted/*
    zfs mount zfsraid0/encrypted
    pvesm add dir encrypted --path /zfsraid0/encrypted --content images,rootdir,vztmpl,iso,snippets
    exit 0
fi
echo "something went wrong"
exit 1
 
that looks rather wrong. you probably want to simply add "is_mountpoint" to your 'dir' storage definition, to tell PVE that it should only consider it activated if it is mounted? also, your check is racy, between the 'if' conditional and 'pvesm remove encrypted', it could actually get mounted and your script would remove everything stored on that dataset..
 
So with "is_mountpoint" it wont create empty subfolders if is not mounted?
Because now if somehow dataset wont be mounted (because of lack of encryption key, which used to be caused by lack of nfs share/network connection) the subdirectiories like dump, iso etc are created anyway and they prevent to mount dataset manually or on second boot. Thats why this "dodgy" solution with deleting everything (empty folders) in dataset if is not mounted.
 
So with "is_mountpoint" it wont create empty subfolders if is not mounted?
Because now if somehow dataset wont be mounted (because of lack of encryption key, which used to be caused by lack of nfs share/network connection) the subdirectiories like dump, iso etc are created anyway and they prevent to mount dataset manually or on second boot. Thats why this "dodgy" solution with deleting everything (empty folders) in dataset if is not mounted.

yes. is_mountpoint will treat the storage as offline, until something gets mounted in the configured path.
 

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!