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
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
(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.
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
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.
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.
(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
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.
(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.
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.
(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.
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.
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