Creating Single SSD VDEV For Containers And VMs

WhosTheBosch

Member
Jan 6, 2020
8
0
6
I'm increasing my use of ZFS on my system as I currently use it for the boot disk since it's the only thing that would work with UEFI. I was wondering if what I'm trying to do with my single disk vdev looks correct? I realize there's no replication of files, I'll be creating a hdd based raidz pool for that which this ssd vdev will snapshot to. So for the ease of zfs snapshots, along with compression, I decided to use a single disk vdev rather than use XFS.

Intel P4510 SSD Info
Code:
smartctl /dev/nvme0n1 -a
=== START OF INFORMATION SECTION ===
Model Number:                       INTEL SSDPE2KX020T8
Total NVM Capacity:                 2,000,398,934,016 [2.00 TB]
Unallocated NVM Capacity:           0
Controller ID:                      0
Number of Namespaces:               128
Namespace 1 Size/Capacity:          2,000,398,934,016 [2.00 TB]
Namespace 1 Formatted LBA Size:     512
Maximum Data Transfer Size:         32 Pages

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         2
 1 -    4096       0         0

fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: INTEL SSDPE2KX020T8
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

ZFS Commands
Code:
P4510 SSD
# create ssd pool
zpool create p4510 -o ashift=9 -m /mnt/p4510 /dev/nvme0n1
#set compression
zfs set compression=lz4 p4510
# use containers dataset for containers
zfs create p4510/containers
zfs set recordsize=1M p4510/containers
# create temp dataset for bittorrents
zfs create p4510/bittorrent
zfs set recordsize=1M p4510/bittorrent
# setup zvol for vms
zfs create -V ?? -s -o compression=on p4510/vms
# set VM zvol blocksize
zfs set volblocksize=4k p4510/vms

Questions
1) For the SSD is keeping the 512 ashift=9 size OK, or should it be reformatted for 4k? How? Wouldn't 512 be more efficient for use of space?
2) Is there a way to set the zvol without specifying the size? I want to have all VMs in that zvol and would like it to have access to all the space on the disk if needed.
3) Should you have a zvol per vm?
4) I've noticed that elsewhere using qcow2 on datasets is recommended, why is it not on Proxmox?
5) QCOW2 VMs will pause when they run out of disk space, anyway to have zvols do this behaviour?
 
Can someone tell me if I did this correctly? I don't understand how to create a zvol for my VMS.

Code:
root@pve:~# zpool create p4510 -o ashift=12 -m /mnt/p4510 *DISK_ID*
root@pve:~# zfs set compression=lz4 p4510
root@pve:~# zfs create p4510/containers
root@pve:~# zfs set recordsize=1M p4510/containers
root@pve:~# zfs create p4510/downloads
root@pve:~# zfs set recordsize=1M p4510/downloads
root@pve:~# zfs set quota=1000G p4510/downloads
root@pve:~# zfs create p4510/vms
root@pve:~# zfs set recordsize=4k p4510/vms
root@pve:~# zfs set quota=1000G p4510/vms

After that, the datasets don't show up in the storage.cfg, so they have to be added to it. So then in the Proxmox Interface:

Datacenter > Storage
Add ZFS
ID: containers
ZFS Pool: p4510/containers
Content: Container
Enable: Yes
Thin Provision: Yes
Block Size: 1M

Add ZFS
ID: vms
ZFS Pool: p4510/vms
Content: Disk Image
Enable: Yes
Thin Provision: Yes
Block Size: 4k

Now when I want to create a new VM I can do so with using vms storage for a VM and containers can be created in containers storage?
 

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!