Description of problem: When running virt-sparsify: $ virt-sparsify /dev/fedora/win7x32dynamic-b win7x32dynamic-b.img qemu-img version 1.2 Create overlay file to protect source disk ... Examine source disk ... ◓ 25% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒═════════════════════════════════════════════════⟧ --:-- 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00 Fill free space in /dev/sda1 with zero ... Fatal error: exception Guestfs.Error("zero_free_space: open: /sysroot//ujqqq135.rd3: Cannot allocate memory") Version-Release number of selected component (if applicable): 1.20.0 How reproducible: 100% Setting LIBGUESTFS_MEMSIZE=10000 makes no difference. Steps to Reproduce: 1. See above.
Created attachment 664176 [details] Complete output with trace & debug
The "filesystem" isn't really FAT, although file, vfs-type and even the kernel recognize and mount it: ><rescue> file -bsL /dev/sda1 x86 boot sector, code offset 0x58, OEM-ID "FrLdr1.0", sectors/cluster 8, Media descriptor 0xf8, heads 255, hidden sectors 63, sectors 12578832 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 12261, reserved3 0xff0000, physical drive 0xff, physical drive 0x7f, serial number 0x9d1f29e7, unlabeled ><rescue> mount /dev/sda1 /sysroot ><rescue> touch /sysroot/foo touch: cannot touch '/sysroot/foo': Cannot allocate memory ><rescue> ls -l /sysroot [ 94.224685] FAT-fs (sda1): error, invalid access to FAT (entry 0x38666435) [ 94.228424] FAT-fs (sda1): Filesystem has been set read-only ls: cannot access /sysroot/ab_km_re.por: Input/output error [ 94.233619] FAT-fs (sda1): error, invalid access to FAT (entry 0x705f5f79) ls: cannot access /sysroot/805e8 r.__k: Input/output error [ 94.237516] FAT-fs (sda1): error, invalid access to FAT (entry 0x66663838) ls: cannot access /sysroot/_km_new_.map: Input/output error [ 94.239765] FAT-fs (sda1): error, invalid access to FAT (entry 0x736b5f62) ls: cannot access /sysroot/fffffff8.188: Input/output error [ 94.241080] FAT-fs (sda1): error, invalid access to FAT (entry 0x66663838) ls: cannot access /sysroot/xfrm_sta.te_: Input/output error [ 94.242445] FAT-fs (sda1): error, invalid access to FAT (entry 0x62615f6d) ls: cannot access /sysroot/ff818806.b1: Input/output error [ 94.243753] FAT-fs (sda1): error, invalid access to FAT (entry 0x66663866) ls: cannot access /sysroot/tab_xfrm._tm: Input/output error [ 94.245047] FAT-fs (sda1): error, invalid access to FAT (entry 0x665f6361) ls: cannot access /sysroot/6d0 r __.kst: Input/output error [ 94.246319] FAT-fs (sda1): error, invalid access to FAT (entry 0x7473785f) ls: cannot access /sysroot/ffffff81.880: Input/output error [ 94.247537] FAT-fs (sda1): error, invalid access to FAT (entry 0x66666666) ls: cannot access /sysroot/state_lo.oku: Input/output error [ 94.248861] FAT-fs (sda1): error, invalid access to FAT (entry 0x5f6d5f65) ls: cannot access /sysroot/06f7 r _._ks: Input/output error [ 94.250159] FAT-fs (sda1): error, invalid access to FAT (entry 0x66663838) ls: cannot access /sysroot/xfrm_sta.te_: Input/output error [ 94.251444] FAT-fs (sda1): error, invalid access to FAT (entry 0x64616666) ls: cannot access /sysroot/_kstrtab._xf: Input/output error [ 94.252869] FAT-fs (sda1): error, invalid access to FAT (entry 0x66666666) ls: cannot access /sysroot/ab_xfrm_.sta: Input/output error [ 94.254249] FAT-fs (sda1): error, invalid access to FAT (entry 0x5f6d5f65) ls: cannot access /sysroot/07b5 r _._ks: Input/output error [ 94.255567] FAT-fs (sda1): error, invalid access to FAT (entry 0x72667461) ls: cannot access /sysroot/07db r _._ks: Input/output error [ 94.256869] FAT-fs (sda1): error, invalid access to FAT (entry 0x66666666) ls: cannot access /sysroot/ab_xfrm_.sta: Input/output error [ 94.258185] FAT-fs (sda1): error, invalid access to FAT (entry 0x5f6d6967) ls: cannot access /sysroot/0801 r _._ks: Input/output error [ 94.259550] FAT-fs (sda1): error, invalid access to FAT (entry 0x66663038) ls: cannot access /sysroot/tab_xfrm._in: Input/output error [ 94.260834] FAT-fs (sda1): error, invalid access to FAT (entry 0x736b5f62) ls: cannot access /sysroot/fffffff8.188: Input/output error [ 94.262162] FAT-fs (sda1): error, invalid access to FAT (entry 0x66663830) ls: cannot access /sysroot/xtract_o.utp: Input/output error [ 94.263451] FAT-fs (sda1): error, invalid access to FAT (entry 0x38666538) ls: cannot access /sysroot/tab_pskb._pu: Input/output error [ 94.264803] FAT-fs (sda1): error, invalid access to FAT (entry 0x62615f6d) ls: cannot access /sysroot/ff818809.14: Input/output error [ 94.266144] FAT-fs (sda1): error, invalid access to FAT (entry 0x736b5f62) ls: cannot access /sysroot/fffffff8.188: Input/output error [ 94.267451] FAT-fs (sda1): error, invalid access to FAT (entry 0x5f366967) ls: cannot access /sysroot/a14 r __.kst: Input/output error [ 94.268758] FAT-fs (sda1): error, invalid access to FAT (entry 0x72746e69) ls: cannot access /sysroot/fffff818.80a: Input/output error [ 94.270114] FAT-fs (sda1): error, invalid access to FAT (entry 0x66663831) ls: cannot access /sysroot/ab_inet6._ge: Input/output error [ 94.271456] FAT-fs (sda1): error, invalid access to FAT (entry 0x735f5f74) ls: cannot access /sysroot/0a8a r _._ks: Input/output error [ 94.272831] FAT-fs (sda1): error, invalid access to FAT (entry 0x6c666666) ls: cannot access /sysroot/rtab_ip6._ds: Input/output error [ 94.274181] FAT-fs (sda1): error, invalid access to FAT (entry 0x5f207472) ls: cannot access /sysroot/r ffffff.ff8: Input/output error [ 94.275519] FAT-fs (sda1): error, invalid access to FAT (entry 0x76657369) ls: cannot access /sysroot/46 r __k.str: Input/output error [ 94.276810] FAT-fs (sda1): error, invalid access to FAT (entry 0x725f6f5f) ls: cannot access /sysroot/0b6e r _._ks: Input/output error [ 94.278118] FAT-fs (sda1): error, invalid access to FAT (entry 0x5f207472) ls: cannot access /sysroot/t ffffff.ff8: Input/output error [ 94.279438] FAT-fs (sda1): error, invalid access to FAT (entry 0x7473785f) ls: cannot access /sysroot/ffffff81.880: Input/output error [ 94.280752] FAT-fs (sda1): error, invalid access to FAT (entry 0x65736f6b) ls: cannot access /sysroot/kstrtab_.com: Input/output error [ 94.282020] FAT-fs (sda1): error, invalid access to FAT (entry 0x736b5f62) ls: cannot access /sysroot/fffffff8.188: Input/output error total 79813728 -rwxr-xr-x 1 root root 825779814 Mar 6 2031 r __kst.rta -rwxr-xr-x 1 root root 825779814 Mar 6 2031 r __kst.rta -r-xr-xr-x 1 root root 1684633954 Nov 7 2030 0 r __ks.trt d????????? ? ? ? ? ? 06f7 r _._ks d????????? ? ? ? ? ? 07b5 r _._ks d????????? ? ? ? ? ? 07db r _._ks d????????? ? ? ? ? ? 0801 r _._ks d????????? ? ? ? ? ? 0a8a r _._ks d????????? ? ? ? ? ? 0b6e r _._ks -r-xr-xr-x 1 root root 1711962470 Nov 14 2035 3 r __ks.trt d????????? ? ? ? ? ? 46 r __k.str -r-xr-xr-x 1 root root 1684633954 Nov 7 2030 6 r __ks.trt d????????? ? ? ? ? ? 6d0 r __.kst d????????? ? ? ? ? ? 805e8 r.__k -r-xr-xr-x 1 root root 1852399467 Oct 31 2039 9 r __ks.trt -r-xr-xr-x 1 root root 1852399467 Oct 31 2039 9 r __ks.trt -rwxr-xr-x 1 root root 1953656688 Oct 31 2037 __kstrta.b_x -rwxr-xr-x 1 root root 1953656688 Oct 31 2037 __kstrta.b_x -r-xr-xr-x 1 root root 943206712 Mar 6 2031 __xfrm_s.tat d????????? ? ? ? ? ? _km_new_.map -r-xr-xr-x 1 root root 943206712 Mar 6 2031 _kstrtab._in -rwxr-xr-x 1 root root 1936416607 Mar 4 1996 _protosw.?ff -rwxr-xr-x 1 root root 1635021428 Oct 31 2027 _skb?fff.fff d????????? ? ? ? ? ? a14 r __.kst d????????? ? ? ? ? ? ab_inet6._ge d????????? ? ? ? ? ? ab_km_re.por d????????? ? ? ? ? ? ab_xfrm_.sta d????????? ? ? ? ? ? ab_xfrm_.sta -rwxr-xr-x 1 root root 1953721183 Jan 1 2037 ath_dup?.fff -rwxr-xr-x 1 root root 1600069746 Nov 1 2029 b_ip6_xm.it? -r-xr-xr-x 1 root root 1801678707 Nov 18 2035 e r __ks.trt -rwxr-xr-x 1 root root 1920234347 Mar 18 1996 e_algs?f.fff -rwxr-xr-x 1 root root 1920234347 Mar 18 1996 e_sort?f.fff -rwxr-xr-x 1 root root 1953721183 Jan 1 2037 er_type?.fff -rwxr-xr-x 1 root root 1936416607 Mar 3 1996 et_byidx.?ff -rwxr-xr-x 1 root root 1869373300 Sep 22 2027 f81880ab.5 r d????????? ? ? ? ? ? ff818806.b1 d????????? ? ? ? ? ? ff818809.14 -rwxr-xr-x 1 root root 1818321759 Mar 24 2031 fff81880.961 -rwxr-xr-x 1 root root 1701273453 Mar 2 2040 ffff8188.068 d????????? ? ? ? ? ? fffff818.80a d????????? ? ? ? ? ? ffffff81.880 -????????? ? ? ? ? ? ffffff81.880 d????????? ? ? ? ? ? fffffff8.188 d????????? ? ? ? ? ? fffffff8.188 d????????? ? ? ? ? ? fffffff8.188 d????????? ? ? ? ? ? fffffff8.188 -r-xr-xr-x 1 root root 544350262 Jan 24 2004 g_get_by.nam -rwxr-xr-x 1 root root 1600069746 Mar 2 2029 getsocko.pt? -rwxr-xr-x 1 root root 1920234347 Mar 18 1996 insert?f.fff -rwxr-xr-x 1 root root 1953657971 Sep 1 2027 ioctl?ff.fff d????????? ? ? ? ? ? kstrtab_.com -rwxr-xr-x 1 root root 1635021428 Oct 31 2027 okup?fff.fff d????????? ? ? ? ? ? r?ffffff.ff8 -rwxr-xr-x 1 root root 1650553970 Oct 31 2033 red?ffff.fff -rwxr-xr-x 1 root root 1650553970 Oct 31 2033 red?ffff.fff -rwxr-xr-x 1 root root 1920234347 Mar 18 1996 resume?f.fff -rwxr-xr-x 1 root root 1920234347 Mar 18 1996 resume?f.fff -r-xr-xr-x 1 root root 946234982 Mar 6 2031 rtab___s.ecp d????????? ? ? ? ? ? rtab_ip6._ds -r-xr-xr-x 1 root root 1717986918 Mar 6 2031 rtab_xfr.m_r d????????? ? ? ? ? ? state_lo.oku -rwxr-xr-x 1 root root 1953657971 Sep 1 2027 stroy?ff.fff -rwxr-xr-x 1 root root 1953657971 Sep 1 2027 stroy?ff.fff -r-xr-xr-x 1 root root 1717963380 Nov 3 2033 strtab_c.omp d????????? ? ? ? ? ? t?ffffff.ff8 -rwxr-xr-x 1 root root 1801412384 Sep 24 2028 t6_looku.p?f -rwxr-xr-x 1 root root 1936416607 Mar 4 1996 t_acqseq.?ff d????????? ? ? ? ? ? tab_pskb._pu d????????? ? ? ? ? ? tab_xfrm._in -r-xr-xr-x 1 root root 946234982 Mar 6 2031 tab_xfrm._st -r-xr-xr-x 1 root root 946234982 Mar 6 2031 tab_xfrm._st d????????? ? ? ? ? ? tab_xfrm._tm -rwxr-xr-x 1 root root 1953657971 Sep 1 2027 tinfo?ff.fff -rwxr-xr-x 1 root root 1717986918 Mar 17 1985 trtab_xf.rm_ -rwxr-xr-x 1 root root 1717986918 Mar 17 1985 trtab_xf.rm_ -rwxr-xr-x 1 root root 1953721183 Jan 1 2037 up_flow?.fff -rwxr-xr-x 1 root root 1920234347 Mar 18 1996 update?f.fff -r-xr-xr-x 1 root root 1717986918 Mar 4 1985 xfrm_cou.nt_ d????????? ? ? ? ? ? xfrm_sta.te_ -????????? ? ? ? ? ? xfrm_sta.te_ d????????? ? ? ? ? ? xtract_o.utp
Matt: This is the second disk in a Windows dynamic disk array. Is there some way to tell that this isn't really a FAT filesystem, so we can add that information to the kernel / blkid?
The MBR partition type is 0x42: Name Type VFS Label MBR Size Parent /dev/sda1 filesystem vfat - - 2.0G - /dev/sda1 partition - - 42 2.0G /dev/sda /dev/sda device - - - 2.0G - I wonder if the solution would be to avoid these partitions when we see that partition type? According to http://thestarman.pcministry.com/asm/mbr/PartTypes.htm this type means: 42 : -- Secure File System, Windows 2000/XP (NT 5): Dynamic extended partition PTS-DOS 6.70 & BootWizard: Alternative Linux swap and DR-DOS.
Fixed upstream: https://github.com/libguestfs/libguestfs/commit/eab324bbbb6e38120f5882f7e0fadb86e322557c