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 685009 - Got error when expanding ntfs filesystem
Summary: Got error when expanding ntfs filesystem
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs
Version: 6.1
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-03-15 03:30 UTC by Yufang Zhang
Modified: 2011-12-06 10:31 UTC (History)
2 users (show)

Fixed In Version: libguestfs-1.7.17-23.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 10:31:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1512 0 normal SHIPPED_LIVE libguestfs bug fix update 2011-12-06 00:39:11 UTC

Description Yufang Zhang 2011-03-15 03:30:46 UTC
Description of problem:
Got error when expanding ntfs filesystem via ntfsresize, while shrinking does work.

Version-Release number of selected component (if applicable):
><fs> version
major: 1
minor: 7
release: 17
extra: 

How reproducible:
Always

Steps to Reproduce:

1. make ntfs filesystem and get filesystem size:

><fs> mkfs ntfs /dev/vda1
libguestfs: trace: mkfs "ntfs" "/dev/vda1"
libguestfs: trace: mkfs = 0

><fs> mount /dev/vda1 /
libguestfs: trace: mount "/dev/vda1" "/"
libguestfs: trace: mount = 0

><fs> statvfs /
libguestfs: trace: statvfs "/"
libguestfs: trace: statvfs = <struct guestfs_statvfs *>
bsize: 4096
frsize: 4096
blocks: 25584
bfree: 24959
bavail: 24959
files: 132604
ffree: 132585
favail: 132585
fsid: 0
flag: 0
namemax: 255

2. shrink filesystem size to half of the original size:

><fs> umount /
libguestfs: trace: umount "/"
libguestfs: trace: umount = 0

><fs> ntfsresize-size /dev/vda1 52396032
libguestfs: trace: ntfsresize_size "/dev/vda1" 52396032
libguestfs: trace: ntfsresize_size = 0

3. make sure filesystem size shrinks as requested:

><fs> mount /dev/vda1 /
libguestfs: trace: mount "/dev/vda1" "/"
libguestfs: trace: mount = 0

><fs> statvfs /
libguestfs: trace: statvfs "/"
libguestfs: trace: statvfs = <struct guestfs_statvfs *>
bsize: 4096
frsize: 4096
blocks: 12791
bfree: 12166
bavail: 12166
files: 81432
ffree: 81413
favail: 81413
fsid: 0
flag: 0
namemax: 255

4. try to expand filesystem size to original size via ntfsresize

><fs> umount /
libguestfs: trace: umount "/"
libguestfs: trace: umount = 0

><fs> ntfsresize /dev/vda1
libguestfs: trace: ntfsresize "/dev/vda1"
libguestfs: trace: ntfsresize = -1 (error)
libguestfs: error: ntfsresize: /dev/vda1: 

  
Actual results:
Got error when expanding ntfs filesystem size.

Expected results:

Additional info:

Comment 1 Yufang Zhang 2011-03-15 03:42:00 UTC
Another issue to take notice. When shrinking the ntfs filesystem, filesystem size specified in ntfsresize-size is 52396032 bytes, which is 12792 blocks. But statvfs reports block counts is 12791, which is one block less than requested. Is is a problem? (I didn't file another bug for this issue for it is a minor one.)

Comment 2 Richard W.M. Jones 2011-03-15 08:50:47 UTC
I'll have a closer look later, but I think this is
by design -- the ntfsresize utility cannot resize the
same filesystem twice in a row without the VM being
rebooted and checked (ie. chkdsk/scandisk).

It will probably work if you boot the VM and let it
do the check between resizes.

Comment 3 Richard W.M. Jones 2011-06-10 09:33:39 UTC
I'm going to investigate this for 6.2.  I think
comment 2 is the correct analysis, but this limitation
in ntfsresize should be documented.

Comment 4 Richard W.M. Jones 2011-07-12 13:16:48 UTC
Patch posted:
https://www.redhat.com/archives/libguestfs/2011-July/msg00023.html

Comment 6 Richard W.M. Jones 2011-08-10 12:43:47 UTC
I've included the documentation fix in
libguestfs-1.7.17-23.el6.

The other two commits can't be easily applied to RHEL 6.2
because virt-resize was rewritten from Perl -> OCaml between
1.8 and 1.12.  In RHEL 6.3 we may rebase libguestfs, so we will
get those two commits as well.

Comment 8 Jinxin Zheng 2011-08-18 09:45:58 UTC
Checked in libguestfs-1.7.17-26, the following info is documented in ntfsresize's help.

    *Note:* After the resize operation, the filesystem is marked as
    requiring a consistency check (for safety). You have to boot into
    Windows to perform this check and clear this condition. Furthermore,
    ntfsresize refuses to resize filesystems which have been marked in this
    way. So in effect it is not possible to call ntfsresize multiple times
    on a single filesystem without booting into Windows between each resize.

Comment 9 errata-xmlrpc 2011-12-06 10:31:26 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.

http://rhn.redhat.com/errata/RHBA-2011-1512.html


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