RAID1 LVM Directory as VM Storage? Size mismatch between PVE GUI and console.

apap

Member
Apr 18, 2021
24
2
8
50
Due to other posts online stating that RAID1 ZFS requires gobs of system memory, I plan to put my VMs in an RAID1 LVM setup instead. I would then mount this RAID1 LV as a directory in datacenter storage. Is this an acceptable method of running VMs in a production environment?

----

Testing PVE under virtualbox:

I created the RAID1 LV to a size of 5G (PV: 2 disks of 20GB ea = 5GB used, 15GB unused). I then created the ext4 filesystem on the LV.

The method I used to add the LV as a directory in datacenter storage (I am not sure if the following is correct but it seems to work):
- kpartx -a /dev/vg/lv (I believe this step maps the LV to /dev/mapper/lv)
- mount /dev/mapper/lv /mnt/lv
- I then went to datacenter storage and added /mnt/lv as a directory and selected all content type

1619315239268.png

----

Instead of reading the directory as the 5GiB LV that it is based on, it reads it as 18.4GiB (the entire VG including non allocated space). Oddly when I first added the directory it stated correctly 5GiB, however on PVE reboot it changes to 18.4GiB.

Is this expected behavior?

1619315198911.png
 
Last edited:
You should ad the "is_mountpoint" option so PVE knows to expect a FS mounted at the path and only activate that storage once it is mounted.

But why go the way with a directory storage if you can use a (thin) LVM directly to store VM disks? To store other things like backups, ISO images and such you still need a file system.
Due to other posts online stating that RAID1 ZFS requires gobs of system memory
How much memory do you have available? While it is true that a lot of free memory helps because ZFS will use it as read cache, it is not mandatory. Using any raidz though for VMs is not the best idea as you don't have such great performance and you will most likely be surprised by the space usage due to parity data. Which is why we recommend RAID10 like pools (mirror vdevs) for VM storage. This is all explained in more detail in our admin guide: https://pve.proxmox.com/pve-docs/pve-admin-guide.html#sysadmin_zfs_raid_considerations