Organizing storage in an orderly fashion using ZFS

norritt

Member
Sep 11, 2020
2
0
6
124
Organizing storage

I decided to try out Proxmox on my VM server. So far I like Proxmox
lot, it seems to be a really great product. The only thing that gives me
serious headaches is proper management of storage. Either I
fundamentally do not understand how storage managment in
Proxmox is supposed to work, or storage management in Proxmox is
very chaotic/buggy.

I use a ZFS mirror on two SATA SSDs to host the OS and a RAID-Z1
of four 8TB drives with a 1 TB NVMe SSD as L2ARC cache.

All disposable data OS and ISO images are stored in the /rpool.
The actual containers and VMs are supposed to go to the zpool0.
While this sounds like an easy enough setup, I've run into a lot of
road blocks.

To provide a better overview, things look roughly like this:

Code:
zpool status
  pool: rpool
state: ONLINE
  scan: none requested
config:

    NAME                                                     STATE     READ WRITE CKSUM
    rpool                                                    ONLINE       0     0     0
      mirror-0                                               ONLINE       0     0     0
        ata-Samsung_SSD_860_EVO_500GB-part3                  ONLINE       0     0     0
        ata-Samsung_SSD_860_EVO_500GB-part3                  ONLINE       0     0     0

errors: No known data errors

  pool: zpool0
state: ONLINE
  scan: none requested
config:

    NAME                                            STATE     READ WRITE CKSUM
    zpool0                                          ONLINE       0     0     0
      raidz1-0                                      ONLINE       0     0     0
        ata-HGST_HUS728T8TALE6L4                    ONLINE       0     0     0
        ata-HGST_HUS728T8TALE6L4                    ONLINE       0     0     0
        ata-HGST_HUS728T8TALE6L4                    ONLINE       0     0     0
        ata-HGST_HUS728T8TALE6L4                    ONLINE       0     0     0
    cache
      nvme-Samsung_SSD_970_EVO_1TB  ONLINE       0     0     0

First attempt:
Initially I did plan to create multiple ZFS datasets to separate
disk images, container images, backups. This would allow me
to define individual quotas and reserve space for each type
of data.

While I was not able create ZFS datasets using the UI, it is possible
to create them via shell. Once I create a storage location based on
a manually created dataset via the Datacenter -> Storage UI, Proxmox
implicitly creates its own subfolders, and I end up with redundant paths
(e.g. /zpool0/images/images). Where zpool0/images is the ZFS dataset
and images is the auto-generated subfolder To avoid such a messy folder
structure I took a different approach...

Second attempt:
... gave up the ability to define individual quotas and used a
global zpool without extra datasets instead. Unfortunately it is
not possible to store "container templates" or "VZDUmp backup files"
directly into the root dataset of a zpool, is there any reason for
that?

proxmox_zfs_root_storage.png

Third attempt:
Since I can only store disk images and containers into the "zpool0"
root dataset I have to create sub directories inside zpool0, using
Datacenter -> Storage -> Add -> Directory. Once a directory is
created that way, I can assign this directory to store anything:
Disk images, ISO images, Container templates, VZDump backup files,
Containers, Snippets.

proxmox_zfs_subdirectory_under_zpool0.png

However for each directory I add under zpool0, Proxmox also adds the
available free space in zpool0 to the total amount of available
space. I.e. I have ~20TB of actual usable storage in zpool0 if I add
one sub directory as storage location the Datacenter -> Summary
suddenly shows 40TB of total storage, if I add another directory it
becomes 60TB of storage and so on.

Storage with one sub directory
proxmox_storage_with_one_zpool_subdir.png

Storage with two subdirectories:
proxmox_storage_with_two_zpool_subdirs.png

With distinct sub directories set up for every type of data (one
for disk images, one for Containers ...), the root dataset zpool0
itself should not be a destination for any data. Unfortunately it
is impossible to assign "no content" to the zpool0 in the Proxmox UI.
It has to either store "disk images" or "containers". The only way I
found to remove the root dataset "zpool0" from the list of storage
locations was to disable it. Once disabled zpool0 will not come online
anymore after a reboot. Instead an empty directory structure will be
created in a folder /zpool0 on the root fs. This prevents the /zpool0
dataset from being mounted, all data appears to be gone. This
can be amended by deleting the empty directory structure,
adding the "immutable" attribute to the /zpool0 and then mounting
the zfs root dataset manually.

After three failed attempts I'm out of ideas. Is there any way to organize
storage in an orderly fashion when using a ZFS pool as main data store?
 
Last edited:
I would highly recommend to build an understanding how exactly ZFS works.

This can be very confusing (I experienced it myself ;)) when first starting to work with it.
In the end it will make sense I guess.

About the proxmox ui: a developer would need to confirm / clarify but my guess is due to the nature of ZFS the ui will pick up the values from ZFS and sum them up (which as you say is questionable as it doesn't reflect reality, but the system reports it like that...).

Afaik You can limit ZFS datasets in size which should then (according to my theory) Al's be reflected in the ui
 
Hey tburger,

I think that my problems have don't have anything to do with ZFS but only how ZFS is integrated into Proxmox. I could easily create a clean storage setup using the CLI, unfortunately Proxmox enforces its own subfolder structure on top of that. Also Proxmox does not allow to save certain types of data into a ZFS pools/datasets without creating additional directories in the UI. This results in the issues I described above.

Based on my observations I would assume that even with ZFS quotas in place the storage would be counted twice. Once for the root dataset "zpool0" and then a second time by summing the quota for each dataset created under zpool0. Even if quotas would work to correct storage space calculation I believe this to be a bug. It should be possible to use ZFS without quota and still see the correct amount of available storage space.
 

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!