Defaults: Switch default disk from virtio-blk-pci to virtio-scsi-pci

Currently, the virtio specification does not include provision for the TRIM (aka DISCARD) command that allows a guest operating system to signal the disk hardware that blocks have become unused so that the underlying device may clear the physical data.

The TRIM/DISCARD command was introduced for SSD disks as an extension to the AHCI specification that is used in SATA systems.

With Virtual Machines we can use this command to tell QEMU's Qcow2 driver to reclaim unused space in the disk image. This ensures the disk image file is kept to the smallest size possible where without the TRIM/DISCARD command it grows to it's maximum configured size and never shrinks again when data is deleted.

Let's swap our default disk driver from `virtio-blk-pci` which does not support TRIM to `virtio-scsi-pci` which does.
pull/571/head
Dani Llewellyn 2 years ago committed by Martin Wimpress
parent bfd7a05ff1
commit fb8deb10e8
  1. 5
      quickemu

@ -1103,8 +1103,9 @@ function vm_boot() {
else
# shellcheck disable=SC2054,SC2206
args+=(-device virtio-blk-pci,drive=SystemDisk
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO})
args+=(-device virtio-scsi-pci,id=scsi0
-device scsi-hd,drive=SystemDisk,bus=scsi0.0,lun=0,rotation_rate=1
-drive id=SystemDisk,if=none,format=qcow2,discard=unmap,file="${disk_img}" ${STATUS_QUO})
fi
# https://wiki.qemu.org/Documentation/9psetup

Loading…
Cancel
Save