LXC storage other than "local"

Heptan

New Member
Sep 26, 2024
4
0
1
I have a proxmox cluster v 8.3.1, each node has a boot drive (rpool) and 2 SSDs mirrored with ZFS (vm-storage0).

Under cluster>storage there are listed
  • local, Type directory
  • local-zfs, Type ZFS
  • vm-storage0, Type ZFS
Bash:
root@prox3:~# zfs list
NAME                            USED  AVAIL  REFER  MOUNTPOINT
rpool                          2.36G   428G    96K  /rpool
rpool/ROOT                     2.19G   428G    96K  /rpool/ROOT
rpool/ROOT/pve-1               2.19G   428G  2.19G  /
rpool/data                       96K   428G    96K  /rpool/data
rpool/var-lib-vz                121M   428G   121M  /var/lib/vz
vm-storage0                    38.4G  1.64T  38.0G  /vm-storage0
vm-storage0/subvol-104-disk-0   448M  7.56G   448M  /vm-storage0/subvol-104-disk-0

Bash:
root@prox3:~# cat /etc/pve/storage.cfg
dir: local
    path /var/lib/vz
    content iso,backup,vztmpl

zfspool: local-zfs
    pool rpool/data
    content rootdir,images
    sparse 1

zfspool: vm-storage0
    pool vm-storage0
    content rootdir,images
    mountpoint /vm-storage0
    nodes prox3,prox4

Question:
  • When I create a new LXC container, I can only choose storage "local", why?
  • Why can I not enable backup for vm-storage0 in the gui?
 
When I create a new LXC container, I can only choose storage "local", why?
You can only choose "local" as the template source directory. The LXC itself will be stored in any of the other two ZFS storages.

Why can I not enable backup for vm-storage0 in the gui?
Because "backup" type requires a file storage and ZFS is a block storage. You may manually create a zfs filesystem on that zpool, add it as "directory" type of storage and select "backup" as the storage content.
 
you can also just add another dir to storage.cfg pointing to the dataset you want to use as a template/container storage directory, same for backups etc, add as a dir

personally i did this by making a dataset under zfs
example of commands i used you can adjust for your system if you decide to:

Code:
zfs create twelve/backups
zfs set compression=zstd-13 twelve/backups
zfs set recordsize=1M  twelve/backups
(you may not want zstd compression, or a record size of 1M, so be mindful of which options you are using)

then add the created datasets as directories to storage.cfg

example:
Code:
dir: containers
    path /vm-storage0/containers
    content rootdir,images,iso,vztmpl


dir: backups
    path /vm-storage0/backups
    content iso,backup,vztmpl

Code:
images = QEMU/KVM VM images.
rootdir = Allow to store container data.
vztmpl = Container templates.
backup = Backup files (vzdump).
iso = ISO images
snippets = Snippet files, for example guest hook scripts
Proxmox Storage Wiki

then you just use those as options
 
you can also just add another dir to storage.cfg pointing to the dataset you want to use as a template/container storage directory, same for backups etc, add as a dir

personally i did this by making a dataset under zfs
example of commands i used you can adjust for your system if you decide to:

Code:
zfs create twelve/backups
zfs set compression=zstd-13 twelve/backups
zfs set recordsize=1M  twelve/backups
(you may not want zstd compression, or a record size of 1M, so be mindful of which options you are using)

then add the created datasets as directories to storage.cfg

example:
Code:
dir: containers
    path /vm-storage0/containers
    content rootdir,images,iso,vztmpl


dir: backups
    path /vm-storage0/backups
    content iso,backup,vztmpl

<snip>
I was facing a similar problem and think that your answer solves it.
What I'm not understanding is how the storage.cfg file gets updated.... are you manually editing that to add in the dir:backups entry, or is this updated by doing something in the gui, or maybe pvesm?
 
I was facing a similar problem and think that your answer solves it.
What I'm not understanding is how the storage.cfg file gets updated.... are you manually editing that to add in the dir:backups entry, or is this updated by doing something in the gui, or maybe pvesm?
I added them manually. Type in or paste in “nano /etc/pve/storage.cfg” (without quotes) then add in the entries manually with your own path pointing to where ever you need it.

Here is my storage.cfg file which is working for everything added in case you need references for what you can try:
Code:
dir: local
        path /var/lib/vz
        content iso,vztmpl

lvmthin: local-lvm
        thinpool data
        vgname pve
        content images,rootdir

lvmthin: SATA
        thinpool SATA
        vgname SATA
        content rootdir,images
        nodes prox

dir: ten
        path /mnt/pve/ten
        content vztmpl,images,rootdir,backup,iso,sn>
        is_mountpoint 1
        nodes prox

zfspool: onetb-zstd-11
        pool onetb/onetb-vm
        content rootdir,images
        sparse 1

zfspool: one-vm
         pool onetb/one-vm
         content rootdir,images
         sparse 1

zfspool: zfs-vm
        pool twelve/vm
        blocksize 1M
        content rootdir,images
        sparse 1

zfspool: zfs-lz4-vm
        pool twelve/comp-vm
        content rootdir,images
        sparse 1

zfspool: zfs-ex-comp-vm
        pool twelve/extreme-comp-vm
        blocksize 256K
        content images,rootdir
        sparse 1

zfspool: zfs-ai
        pool twelve/ai
        blocksize 1M
        content rootdir,images
        sparse 1

dir: zfs-backups
        path /twelve/backups
        content snippets,backup,rootdir,images
        is_mountpoint yes
        prune-backups keep-all=1
        shared 0

dir: zfs-games
        path /twelve/games
        content images,rootdir
        is_mountpoint yes
        shared 0