Got an HP dl380 g6 for a home lab. Running Rocky Linux 8. I’ve already created my first VM.
I want to mount a new drive to my VM. I want this drive to be ‘thin’ partition (not sure if that’s correct terminology) not static size.
I’d like to use space from sdb1 which is partitioned but not mounted anywhere.
Once created I want to add it to my VM. How do I create a ‘thin’ partition drive for my existing VM? Having trouble finding anything via google.
Thanks!
Easiest would be to create a filesystem on sdb1 and use qcow2 image files. That format is dynamically allocated, supports sparse images, snapshots and discard/TRIM.
Create 1TB disk image :
qemu-img create -f qcow2 disk.qcow2 1T
Resize to 2TB :
qemu-img resize disk.qcow2 2T
You can resize while the disk is attached to the VM and it is running by using the QMP commands, e.g. in libvirt:
virsh> qemu-monitor-command <vm> block_resize drive-virtio-disk0 2T --hmp
You could do something similar with lvmthin but IMO you lose a lot of control/management options.
1 Like