Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1373879

Summary: virt-resize --expand fails with win2008 x86 image on aarch64 uefi host
Product: Red Hat Enterprise Linux 7 Reporter: Xianghua Chen <xchen>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: ptoscano, wshi, xchen
Target Milestone: rc   
Target Release: ---   
Hardware: aarch64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-23 09:40:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1212027    
Attachments:
Description Flags
log.virt-resize_win2008_i386 none

Description Xianghua Chen 2016-09-07 11:12:10 UTC
Created attachment 1198651 [details]
log.virt-resize_win2008_i386

Description of problem:
 virt-resize --expand fails with win2008 x86 image on aarch64 uefi host.

Please refer to the detailed log with -v -x in the attachment.

Version-Release number of selected component (if applicable):
libguestfs-1.32.7-2.el7.aarch64
kernel-4.5.0-3.el7.aarch64
libguestfs-winsupport-7.2-1.el7.aarch64

How reproducible:
Always

Steps to Reproduce:
1. Prepare a win2008 x86 image:
Win2008-32-hvm.raw
2.
# virt-filesystems -a images/Win2008-32-hvm.raw -l
Name       Type        VFS   Label       Size         Parent
/dev/sda1  filesystem  ntfs  OS_Install  15728640000  -
3.
# qemu-img create libguestfs_virt-resize_test.img 17106127360

4.
# virt-resize --expand /dev/sda1 images/Win2008-32-hvm.raw libguestfs_virt-resize_test.img
... ...
[  74.9] Expanding /dev/sda1 using the 'ntfsresize' method
virt-resize: error: libguestfs error: ntfsresize: /dev/sda1: ntfsresize
v2015.3.14 (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: 17103912960 bytes (17104 MB)
New volume size    : 17103909376 bytes (17104 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 [...]



Actual results:
As above.

Expected results:
Command should finished successfully in step 4.

Additional info:
win2008 x86_64 image is ok.
On ppc64le/x86-64 is ok.

Comment 1 Richard W.M. Jones 2017-02-16 16:41:08 UTC
I tried resizing two different Windows guests on both Fedora 25 and
RHEL 7.3, and I was unable to reproduce this bug at all.  Do you
by chance have the guest image so I can try it?

Comment 2 Xianghua Chen 2017-02-20 07:42:52 UTC
(In reply to Richard W.M. Jones from comment #1)
> I tried resizing two different Windows guests on both Fedora 25 and
> RHEL 7.3, and I was unable to reproduce this bug at all.  Do you
> by chance have the guest image so I can try it?

Were you trying this on  aarch64 uefi host? Were you using Win2008-32 ?As I said, the x86_64 image doesn't have this problem.

We have an nfs server, you can try this one:
  10.8.184.80:/mnt/image/Win2008-32-hvm.raw

Any problem, pls let me know, thank you:)

Comment 3 Richard W.M. Jones 2017-02-20 08:40:27 UTC
(In reply to Xianghua Chen from comment #2)
> (In reply to Richard W.M. Jones from comment #1)
> > I tried resizing two different Windows guests on both Fedora 25 and
> > RHEL 7.3, and I was unable to reproduce this bug at all.  Do you
> > by chance have the guest image so I can try it?
> 
> Were you trying this on  aarch64 uefi host?

Yes.

> Were you using Win2008-32 ?

No.

> As I
> said, the x86_64 image doesn't have this problem.

OK, so it's probably because I was using a 64 bit guest.

> We have an nfs server, you can try this one:
>   10.8.184.80:/mnt/image/Win2008-32-hvm.raw

I'll grab this now and try it, thanks.

Comment 4 Richard W.M. Jones 2017-02-21 15:57:58 UTC
I tried the image on x86_64, and I get the exact same errors:

$ guestfish --ro -a Win2008-32-hvm.raw run : download /dev/sda1 bz1373879.img
$ cp bz1373879.img resized.img
$ truncate -s20G resized.img 
$ virt-rescue -a resized.img
><rescue> ntfsresize /dev/sda 
ntfsresize v2016.2.22 (libntfs-3g)
Device name        : /dev/sda
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.
><rescue> uname -a
Linux (none) 4.10.0-0.rc7.git0.1.fc26.x86_64 #1 SMP Mon Feb 6 15:19:38 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

So I think the problem here is that the image is broken.

Comment 5 Richard W.M. Jones 2017-02-21 15:58:44 UTC
In fact even virt-resize fails on x86_64 on this image:

$ truncate -s 20G resized
$ virt-resize Win2008-32-hvm.raw resized --expand /dev/sda1 
[   0.0] Examining Win2008-32-hvm.raw
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ --:--
**********

Summary of changes:

/dev/sda1: This partition will be resized from 14.6G to 20.0G.  The 
filesystem ntfs on /dev/sda1 will be expanded using the 'ntfsresize' 
method.

**********
[   7.2] Setting up initial partition table on resized
[   7.4] Copying /dev/sda1
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
[  35.8] Expanding /dev/sda1 using the 'ntfsresize' method
virt-resize: error: libguestfs error: ntfsresize: /dev/sda1: ntfsresize 
v2016.2.22 (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: 21472608256 bytes (21473 MB)
New volume size    : 21472604672 bytes (21473 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 [...]

Comment 6 Xianghua Chen 2017-02-23 09:40:57 UTC
(In reply to Richard W.M. Jones from comment #5)
> In fact even virt-resize fails on x86_64 on this image:
> 
> $ truncate -s 20G resized
> $ virt-resize Win2008-32-hvm.raw resized --expand /dev/sda1 
> [   0.0] Examining Win2008-32-hvm.raw
>  100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧
> --:--
> **********
> 
> Summary of changes:
> 
> /dev/sda1: This partition will be resized from 14.6G to 20.0G.  The 
> filesystem ntfs on /dev/sda1 will be expanded using the 'ntfsresize' 
> method.
> 
> **********
> [   7.2] Setting up initial partition table on resized
> [   7.4] Copying /dev/sda1
>  100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧
> 00:00
> [  35.8] Expanding /dev/sda1 using the 'ntfsresize' method
> virt-resize: error: libguestfs error: ntfsresize: /dev/sda1: ntfsresize 
> v2016.2.22 (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: 21472608256 bytes (21473 MB)
> New volume size    : 21472604672 bytes (21473 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 [...]

Yes, I re-installed one Win2008-32 guest image, it's ok. 
Just weird that I tried  the old image on ppc64le last year it didn't have this problem.
Any way, I'll close this bug for now, sorry for the inconvenient:(