From 5d1c8dfc4c3c2e6d8146c2eb5c443c36ade2ecd7 Mon Sep 17 00:00:00 2001 From: Luke Yelavich <9444357+TheMuso@users.noreply.github.com> Date: Wed, 22 May 2024 08:56:09 +1000 Subject: [PATCH] fix: Do not set the lazy_refcounts option for raw disk images --- quickemu | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/quickemu b/quickemu index 2c6b83b..451de95 100755 --- a/quickemu +++ b/quickemu @@ -786,6 +786,7 @@ function configure_os_quirks() { } function configure_storage() { + local create_options="" echo " - Disk: ${disk_img} (${disk_size})" if [ ! -f "${disk_img}" ]; then # If there is no disk image, create a new image. @@ -796,8 +797,14 @@ function configure_storage() { exit 1;; esac + case ${disk_format} in + qcow2) create_options="lazy_refcounts=on,preallocation=${preallocation}";; + raw) create_options="preallocation=${preallocation}";; + *) true;; + esac + # https://blog.programster.org/qcow2-performance - if ! ${QEMU_IMG} create -q -f "${disk_format}" -o lazy_refcounts=on,preallocation="${preallocation}" "${disk_img}" "${disk_size}"; then + if ! ${QEMU_IMG} create -q -f "${disk_format}" -o "${create_options=}" "${disk_img}" "${disk_size}"; then echo "ERROR! Failed to create ${disk_img} using ${disk_format} format." exit 1 fi