Bug 1176526 - virt-resize cannot shrink ext filesystem by a small amount
Summary: virt-resize cannot shrink ext filesystem by a small amount
Keywords:
Status: NEW
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-22 09:02 UTC by Richard W.M. Jones
Modified: 2021-04-19 10:34 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2014-12-22 09:02:10 UTC
Description of problem:

(Note: reported by Hu Tao here:
https://www.redhat.com/archives/libguestfs/2014-December/msg00160.html )

When you shrink a filesystem by a small amount (eg. -8 MB)
using virt-resize, it cannot cope, giving the following error:

[  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

Version-Release number of selected component (if applicable):

libguestfs latest from git

How reproducible:

100%

Steps to Reproduce:

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

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

Actual results:

[   0.0] Examining test1.img
**********

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.

**********
[   3.0] Setting up initial partition table on test2.img
[   3.0] Copying /dev/sda1
[   4.0] Copying /dev/sda2
[   5.0] Copying /dev/sda3
[   9.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 [...]


Expected results:

Should succeed.


Note You need to log in before you can comment on or make changes to this bug.