Proxmox ZFS Pool Setup
The goal of this procedure is to set up a ZFS pool (Zpool) and its subpools on a Proxmox server that doesn't have dedicated disks for storage ZFS.
Prerequisites
This process is being done to a node that has two drives, sized 4TB. We will be setting a 250GB partition on each drive to serve as the local/local-zfs storage in Proxmox. The remaining free space on the drives will be used to create a second Zpool. During the installation of Proxmox we set the hdsize parameter to 250GB. This will ensure it only uses 250GB of the boot drives for the configuration, leaving the rest untouched. After this, we need to use cfdisk to create partitions out of the remaining storage data. We will leave this without a filesystem as ZFS will be installing its filesystem over these partitions in the next step.
Creating the main pool
(The following has been adapted from the results of zpool history on an existing Zpool.)
zpool create -o ashift=12 <pool name> mirror /dev/disk/by-id/disk1-XXXXXXXXXXXXXX-XXXXXXXXXXXXXX-part3 /dev/disk/by-id/disk2-XXXXXXXXXXXXXX-XXXXXXXXXXXXXX-part3 zfs set compression=zstd <pool name> zfs create <pool name>/vmstorage zfs create <pool name>/vz-dir zfs set sync=disabled <pool name>/vmstorage zfs set atime=on <pool name> zfs set atime=off <pool name>/vmstorage zfs set compression=zstd <pool name>/vmstorage zfs set compression=zstd <pool name>/vz-dir
In the above example, the suffix of -part3 is inferred for demonstrative purposes. Depending on the exact configuration set when installing Proxmox and creating its default local/local-zfs system as well as later using cfdisk, this could be a different partition number.