RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1166618 - virt-resize should give out the detail warning info to let customers know what's going wrong
Summary: virt-resize should give out the detail warning info to let customers know wha...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.1
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-21 11:21 UTC by yuliu
Modified: 2015-03-05 13:47 UTC (History)
7 users (show)

Fixed In Version: libguestfs-1.28.1-1.14.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 13:47:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0303 0 normal SHIPPED_LIVE libguestfs bug fix and enhancement update 2015-03-05 17:34:44 UTC

Description yuliu 2014-11-21 11:21:03 UTC
Description of problem:
virt-resize win2008-32 ended with ntfsresize error when execute  virt-resize --resize or --expand


Version-Release number of selected component (if applicable):
libguestfs-1.28.1-1.13.el7.x86_64

How reproducible:
100%


Steps to Reproduce:
1. Prepare the Win2008-32-hvm.raw and disk.img
2. virt-resize -v -x --resize /dev/sda1=+1024M Win2008-32-hvm.raw disk.img
or virt-resize -v -x --expand /dev/sda1 Win2008-32-hvm.raw disk.img

3. It failed with ntfsresize error. Check the details below.

4. It's ok on Win2008-64 and other Win images.

5. check the disk size and it didn't change.

6. The disk.img was able to boot up.

7. I have tried to reinstall a new Win2008-32-hvm.raw image by ISO, and it still failed.

Actual results:


Addition:
I didn't see any other useful message.
...
trying to open virtio-serial channel '/dev/virtio-ports/org.libguestfs.channel.0'^M
udevadm --debug settle^M
calling: settle^M
libguestfs: recv_from_daemon: received GUESTFS_LAUNCH_FLAG
libguestfs: [06835ms] appliance is up
libguestfs: trace: launch = 0
Expanding /dev/sda1 using the 'ntfsresize' method ...
libguestfs: trace: ntfsresize "/dev/sda1" "force:false"
guestfsd: main_loop: new request, len 0x44^M
ntfsresize -P /dev/sda1^M
guestfsd: error: /dev/sda1: ^M
guestfsd: main_loop: proc 288 (ntfsresize) took 0.25 seconds^M
libguestfs: trace: ntfsresize = -1 (error)
virt-resize: error: libguestfs error: ntfsresize: /dev/sda1:

If reporting bugs, run virt-resize with debugging enabled and include the
complete output:

  virt-resize -v -x [...]
libguestfs: trace: close
libguestfs: closing guestfs handle 0x231b480 (state 2)
libguestfs: trace: internal_autosync
guestfsd: main_loop: new request, len 0x28^M
umount-all: /proc/mounts: fsname=rootfs dir=/ type=rootfs opts=rw freq=0 passno=0^M
umount-all: /proc/mounts: fsname=proc dir=/proc type=proc opts=rw,relatime freq=0 passno=0^M
umount-all: /proc/mounts: fsname=/dev/root dir=/ type=ext2 opts=rw,noatime freq=0 passno=0^M
umount-all: /proc/mounts: fsname=/proc dir=/proc type=proc opts=rw,relatime freq=0 passno=0^M
umount-all: /proc/mounts: fsname=/sys dir=/sys type=sysfs opts=rw,relatime freq=0 passno=0^M
umount-all: /proc/mounts: fsname=tmpfs dir=/run type=tmpfs opts=rw,nosuid,relatime,size=97776k,mode=755 freq=0 passno=0^M
umount-all: /proc/mounts: fsname=/dev dir=/dev type=devtmpfs opts=rw,relatime,size=242024k,nr_inodes=60506,mode=755 freq=0 passno=0^M
fsync /dev/sda^M
guestfsd: main_loop: proc 282 (internal_autosync) took 0.02 seconds^M
libguestfs: trace: internal_autosync = 0
libguestfs: calling virDomainDestroy "guestfs-dypqjcuo5exp4j40" flags=0
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsv5KYRN
"trace2" 2008L, 112409C

Comment 1 Richard W.M. Jones 2014-11-21 12:10:04 UTC
First can you try adding the --ntfsresize-force option:

       --ntfsresize-force
           Pass the --force option to ntfsresize(8), allowing resizing even if
           the NTFS disk is marked as needing a consistency check.  You have
           to use this option if you want to resize a Windows guest multiple
           times without booting into Windows between each resize.

If it still doesn't work after adding that option, then you're
going to have to send me /dev/sda1 from that disk image.  Do this:

  guestfish --ro -a Win2008-32-hvm.raw run : download /dev/sda1 /tmp/sda1
  xz --best /tmp/sda1

and then send me /tmp/sda1.xz

Comment 2 yuliu 2014-11-24 03:12:33 UTC
(In reply to Richard W.M. Jones from comment #1)
> First can you try adding the --ntfsresize-force option:
> 
>        --ntfsresize-force
>            Pass the --force option to ntfsresize(8), allowing resizing even
> if
>            the NTFS disk is marked as needing a consistency check.  You have
>            to use this option if you want to resize a Windows guest multiple
>            times without booting into Windows between each resize.
> 
> If it still doesn't work after adding that option, then you're
> going to have to send me /dev/sda1 from that disk image.  Do this:
> 
>   guestfish --ro -a Win2008-32-hvm.raw run : download /dev/sda1 /tmp/sda1
>   xz --best /tmp/sda1
> 
> and then send me /tmp/sda1.xz

Hey Rich, I just tried the steps as above, it still failed with the same error.

Expanding /dev/sda1 using the 'ntfsresize' method ...
libguestfs: trace: ntfsresize "/dev/sda1" "force:true"
guestfsd: main_loop: new request, len 0x44
ntfsresize -P --force /dev/sda1
guestfsd: error: /dev/sda1: 
guestfsd: main_loop: proc 288 (ntfsresize) took 0.25 seconds
libguestfs: trace: ntfsresize = -1 (error)
virt-resize: error: libguestfs error: ntfsresize: /dev/sda1: 

If reporting bugs, run virt-resize with debugging enabled and include the 
complete output:

  virt-resize -v -x [...]
libguestfs: trace: close

And about the sda1.xz, I'll send it to you later.

Comment 3 Richard W.M. Jones 2014-11-24 11:00:59 UTC
Thanks for sending me the /dev/sda1 filesystem.  I'm afraid
the filesystem appears to be corrupt:

$ ntfsresize sda1 
ntfsresize v2014.2.15 (libntfs-3g)
Device name        : sda1
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 15728636416 bytes (15729 MB)
Current device size: 21474836480 bytes (21475 MB)
New volume size    : 21474832896 bytes (21475 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Cluster accounting failed at 1298595 (0x13d0a3): missing cluster in $Bitmap
Cluster accounting failed at 1298596 (0x13d0a4): missing cluster in $Bitmap
Cluster accounting failed at 1298597 (0x13d0a5): missing cluster in $Bitmap
Cluster accounting failed at 1298598 (0x13d0a6): missing cluster in $Bitmap
Cluster accounting failed at 1298599 (0x13d0a7): missing cluster in $Bitmap
Cluster accounting failed at 1298600 (0x13d0a8): missing cluster in $Bitmap
Cluster accounting failed at 1298601 (0x13d0a9): missing cluster in $Bitmap
Cluster accounting failed at 1298602 (0x13d0aa): missing cluster in $Bitmap
Cluster accounting failed at 1298603 (0x13d0ab): missing cluster in $Bitmap
Cluster accounting failed at 1298604 (0x13d0ac): missing cluster in $Bitmap
Filesystem check failed! Totally 30 cluster accounting mismatches.
ERROR: NTFS is inconsistent. Run chkdsk /f on Windows then reboot it TWICE!
The usage of the /f parameter is very IMPORTANT! No modification was
and will be made to NTFS by this software until it gets repaired.

There is no effective fsck tool on Linux, so you have to run
the suggested chkdsk command on Windows before resizing.

However there is also a bug here, which is that the ntfsresize
API loses the error messages, because the underlying command sends
errors to stdout.  I have posted a patch to fix this:

https://www.redhat.com/archives/libguestfs/2014-November/msg00174.html

Comment 4 yuliu 2014-11-24 11:28:24 UTC
Hey Rich, have you tried on the original image? 

I have reinstalled a new OS, nothing changed, totally clean, and then tried the steps, still failed.

Comment 5 Richard W.M. Jones 2014-11-24 11:36:08 UTC
Nope, I tried the 'sda1.xz' file provided.  If you like I can
try another image, but you'll have to send me that one.

Comment 6 yuliu 2014-11-24 12:03:13 UTC
(In reply to Richard W.M. Jones from comment #5)
> Nope, I tried the 'sda1.xz' file provided.  If you like I can
> try another image, but you'll have to send me that one.

Also login to the machine that I told you. The image Win2008-32-hvm.raw under /home/ is the new OS that I reinstalled.

If you want to reinstall a new one by yourself, here is the ISO image:
#mount 10.66.90.128:/vol/S1/iso/ /mnt/
#ls /mnt/ISO/Win2008/32/
en_windows_server_2008_datacenter_enterprise_standard_sp2_x86_dvd_342333.iso

Comment 7 Richard W.M. Jones 2014-11-25 10:50:22 UTC
I tried Win2008-32-hvm.raw and that resized successfully for me
(on Fedora 21 -- but that is pretty close to what we have in RHEL 7.1).
I don't have enough disk space to try this on my RHEL 7 VM.

Comment 8 yuliu 2014-11-26 09:23:36 UTC
(In reply to Richard W.M. Jones from comment #7)
> I tried Win2008-32-hvm.raw and that resized successfully for me
> (on Fedora 21 -- but that is pretty close to what we have in RHEL 7.1).
> I don't have enough disk space to try this on my RHEL 7 VM.

I tried this image on my Fedora, it succeed. That's really strange because it still failed on RHEL, some time.

I say "some time" because I did succeed once. When I found that partition was already expanded to the largest, so I reduced it by virt-sparsify tool. And then virt-resize, it actually succeed, but only once. 

And I believe that there is nothing to our machine, because we had tried different machines by different person.

I think there was not only one bug here, I wrote a script to do more test, but it costs time, I'll update my result here the time I get it, so let's wait for some hours.

Comment 9 yuliu 2014-11-26 11:47:00 UTC
Hi Rich,

Seems the original image was okay to resize, the filesystem may be broken while copying, I have checked the md5sum and they are actually different. So you can take this bug as comment 3.

Comment 10 Richard W.M. Jones 2014-11-26 13:37:19 UTC
(In reply to yuliu from comment #8)
> I say "some time" because I did succeed once. When I found that partition
> was already expanded to the largest, so I reduced it by virt-sparsify tool.
> And then virt-resize, it actually succeed, but only once. 

This is to be expected with NTFS.  You have to use the --ntfsresize-force
flag to do multiple resizes.  See comment 1.

Comment 12 yuliu 2014-12-09 05:32:13 UTC
Verified: libguestfs-1.28.1-1.14.el7.x86_64

Details:


virt-resize: error: libguestfs error: ntfsresize: /dev/sda1: ntfsresize 
v2014.2.15 (libntfs-3g)
Device name        : /dev/sda1
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 15728636416 bytes (15729 MB)
Current device size: 19325124608 bytes (19326 MB)
New volume size    : 19325121024 bytes (19326 MB)
Checking filesystem consistency ...
Accounting clusters ...
Cluster accounting failed at 1298595 (0x13d0a3): missing cluster in $Bitmap
Cluster accounting failed at 1298596 (0x13d0a4): missing cluster in $Bitmap
Cluster accounting failed at 1298597 (0x13d0a5): missing cluster in $Bitmap
Cluster accounting failed at 1298598 (0x13d0a6): missing cluster in $Bitmap
Cluster accounting failed at 1298599 (0x13d0a7): missing cluster in $Bitmap
Cluster accounting failed at 1298600 (0x13d0a8): missing cluster in $Bitmap
Cluster accounting failed at 1298601 (0x13d0a9): missing cluster in $Bitmap
Cluster accounting failed at 1298602 (0x13d0aa): missing cluster in $Bitmap
Cluster accounting failed at 1298603 (0x13d0ab): missing cluster in $Bitmap
Cluster accounting failed at 1298604 (0x13d0ac): missing cluster in $Bitmap
Filesystem check failed! Totally 30 cluster accounting mismatches.
ERROR: NTFS is inconsistent. Run chkdsk /f on Windows then reboot it TWICE!
The usage of the /f parameter is very IMPORTANT! No modification was
and will be made to NTFS by this software until it gets repaired.

If reporting bugs, run virt-resize with debugging enabled and include the 
complete output:

  virt-resize -v -x [...]


The error details were given, verified as above.

Comment 14 errata-xmlrpc 2015-03-05 13:47:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0303.html


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