$ qemu-img create -f qcow2 -b /tmp/centos-6.img overlay.qcow2
$ virt-sparsify --in-place overlay.qcow2
virt-sparsify: error: disk image 'overlay.qcow2' appears to have a backing
file. You should use copying mode sparsification for this file (see the
virt-sparsify(1) manual).
Thanks: Yaniv Kaul
---
sparsify/in_place.ml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sparsify/in_place.ml b/sparsify/in_place.ml
index 3a2b32c..669c639 100644
--- a/sparsify/in_place.ml
+++ b/sparsify/in_place.ml
@@ -30,6 +30,11 @@ open Cmdline
module G = Guestfs
let rec run disk format ignores machine_readable zeroes =
+ (* If the disk has a backing file, refuse to run (RHBZ#1277705). *)
+ if (new G.guestfs ())#disk_has_backing_file disk then
+ error (f_"disk image '%s' appears to have a backing file. You should
use copying mode sparsification for this file (see the virt-sparsify(1) manual).")
+ disk;
+
(* Connect to libguestfs. *)
let g = new G.guestfs () in
if trace () then g#set_trace true;
--
2.5.0