How to change the size of zvol if it is used by VM

gusto

Well-Known Member
Feb 10, 2018
101
3
58
25
In Proxmox I created from 4x 18TB HDD Raidz (52TB). Then I created a 12 TB zvol and assigned it to VM (Debian). In my debian, I formatted the disc to ext4 and everything works well.

I have some data on the 12 TB section. Now I would like to increase the section to 16TB. Is it possible without data loss?
 
Yes, by setting the zvol size larger (via a zfs command) and by increasing the ext4 size (with resize2fs). If you partitioned the zvol, you need to remove and recreate the same partition with a larger size (with gdisk and partprobe).
All of this can be done while the VM is running. Make sure you have a backup if anything goes wrong. If you stop the VM, you can also boot it (after growing the zvol) with a Gparted Live which provides a GUI for resizing partitions and filesystems.
I hope this gives you some pointers to get started. There are more threads about this on this forum and it's quite similar to using a larger physical drive on a real machine (for which there are guides on the internet).