Description of problem: virt-sparsify also tries to sparsify filesystems on read-only LVs. It should not try this. Version-Release number of selected component (if applicable): F21 version How reproducible: alwyas Steps to Reproduce: 1. Create a VG with a read-only LV (vgchange --permission r VG/LV) 2. Run virt-sparsify on the image containing that LV 3. Actual results: Failure: virt-sparsify: libguestfs error: zero_free_space: unlink: /sysroot//ev85lpbq.s38: Read-only file system Expected results: virt-sparsify ignores the LV/fs. Additional info: 12:48:11 virt-sparsify --check-tmpdir continue --compress installation.qcow2 installation.qcow2.sparse && mv -v installation.qcow2.sparse installation.qcow2 12:48:11 Input disk virtual size = 10737418240 bytes (10.0G) 12:48:11 12:48:11 WARNING: There may not be enough free space on /tmp. 12:48:11 You may need to set TMPDIR to point to a directory with more free space. 12:48:11 12:48:11 Max needed: 10.0G. Free: 4.4G. May need another 5.6G. 12:48:11 12:48:11 Note this is an overestimate. If the guest disk is full of data 12:48:11 then not as much free space would be required. 12:48:11 12:48:11 You can ignore this warning or change it to a hard failure using the 12:48:11 --check-tmpdir=(ignore|continue|warn|fail) option. See virt-sparsify(1). 12:48:11 12:48:11 Create overlay file in /tmp to protect source disk ... 12:48:11 Examine source disk ... 12:48:26 Fill free space in /dev/HostVG/Image-0.0 with zero ... 12:48:29 Fill free space in /dev/HostVG/Image-0.1 with zero ... 12:49:33 virt-sparsify: libguestfs error: zero_free_space: unlink: /sysroot//ev85lpbq.s38: Read-only file system
I think you mean "lvchange", not "vgchange" :-) That had me confused for a while ... Simple reproducer: $ guestfish -N bootrootlv debug sh "lgchange --permission r VG/LV" $ rm -f test2.img $ truncate -s 200M test2.img $ virt-sparsify test1.img test2.img Input disk virtual size = 104857600 bytes (100.0M) Create overlay file in /tmp to protect source disk ... Examine source disk ... Fill free space in /dev/VG/LV with zero ... virt-sparsify: error: libguestfs error: zero_free_space: open: /sysroot//xmjgtnhn.qve: Read-only file system In order to get the read-only status of an LV, we must use guestfs_lvs_full and look for the 'r' flag in the lv_attr field.
(In reply to Richard W.M. Jones from comment #1) > I think you mean "lvchange", not "vgchange" :-) That had me confused > for a while ... Argh. Yes, sorry for that typo.
(In reply to Richard W.M. Jones from comment #1) … > Simple reproducer: > > $ guestfish -N bootrootlv debug sh "lgchange --permission r VG/LV" It should actually be lvchange, instead of lgchange.
Patch posted: https://www.redhat.com/archives/libguestfs/2015-January/msg00127.html
Upstream commits: https://github.com/libguestfs/libguestfs/commit/7d784fb9c90038e94761d9ea928b1c12d62625e9 https://github.com/libguestfs/libguestfs/commit/8d83f57799c5e542e7295d1b03a36ebb9737d90a