Virtio-SCSI and DISCARD with KVM

1 post / 0 new
#1 Tue, 10/24/2017 - 06:58
vapayo

Virtio-SCSI and DISCARD with KVM

Hey all, at first thanks for providing such a nice environment to manage vservers! :-)

I have one question regarding a KVM instance: I would like to use the virtio scsi driver instead of ide/virtio and also setup discard='unmap' on the virtual disk, but I dont see how this can be done inside CloudMin.

Is this possible?

I plan to deploy sparse disk images and want to use fstrim inside the guest to keep those images sparse.

Thanks in advance!

Best regards, Simon

EDIT: I found a way to do it through manual config hacking: Open up /etc/webmin/servers/xxx.serv Set if for disk to none and add an id and discard=unmap:

kvm_drives=media=disk,discard=unmap,index=0,file=/kvm/disk.img,if=none,cache=none,id=drive0

Add required scsi device through the kvm args

kvm_args=-device virtio-scsi-pci,id=scsi0 -device scsi-hd,bus=scsi0.0,drive=drive0

Restart through cloudmin panel