[Libguestfs] virt-resize corrupts ext2 filesystem

Richard W.M. Jones rjones at redhat.com
Mon Dec 22 09:03:01 UTC 2014


On Tue, Dec 16, 2014 at 03:16:49PM +0800, Hu Tao wrote:
> steps to reproduce:
> 
> ./run guestfish -N disk:1536M <<EOF
> part-init /dev/sda mbr
> part-add /dev/sda p 1 1048577
> part-add /dev/sda p 1048578 2097154
> part-add /dev/sda p 2097155 -1
> mkfs ext2 /dev/sda1
> mkfs ext2 /dev/sda2
> mkfs ext2 /dev/sda3
> EOF
> 
> qemu-img create -f raw test2.img 1520M
> 
> ./run virt-resize --format raw --output-format raw --resize /dev/sda1=-2M --resize /dev/sda2=-8M --shrink /dev/sda3 --no-extra-partition test1.img test2.img
> 
> 
> The output:
> 
> ---8<---
> 
> Formatting 'test2.img', fmt=raw size=1593835520 
> [   0.0] Examining test1.img
>  100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ --:--
> **********
> 
> Summary of changes:
> 
> /dev/sda1: This partition will be resized from 512.0M to 510.0M.  The 
> filesystem ext2 on /dev/sda1 will be expanded using the 'resize2fs' method.
> 
> /dev/sda2: This partition will be resized from 512.0M to 504.0M.  The 
> filesystem ext2 on /dev/sda2 will be expanded using the 'resize2fs' method.
> 
> /dev/sda3: This partition will be resized from 512.0M to 503.7M.  The 
> filesystem ext2 on /dev/sda3 will be expanded using the 'resize2fs' method.
> 
> **********
> [  10.0] Setting up initial partition table on test2.img
> [  10.0] Copying /dev/sda1
> [  11.0] Copying /dev/sda2
> [  12.0] Copying /dev/sda3
> [  17.0] Expanding /dev/sda1 using the 'resize2fs' method
> virt-resize: error: libguestfs error: resize2fs: e2fsck 1.42.11 
> (09-Jul-2014)
> The filesystem size (according to the superblock) is 131072 blocks
> The physical size of the device is 130575 blocks
> Either the superblock or the partition table is likely to be corrupt!
> Abort? yes
> 
> If reporting bugs, run virt-resize with debugging enabled and include the 
> complete output:
> 
>   virt-resize -v -x [...]
> 
> --->8---

I can reproduce this too.  I don't have time to look at this now, but
to make sure it's not forgotten, I have filed a bug about it:

https://bugzilla.redhat.com/show_bug.cgi?id=1176526

Thanks,

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list