Bug 547479 - NTFS partitions sometimes fail to mount if mounted read/write
NTFS partitions sometimes fail to mount if mounted read/write
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Richard W.M. Jones
Depends On:
  Show dependency treegraph
Reported: 2009-12-14 13:56 EST by Richard W.M. Jones
Modified: 2011-04-12 13:23 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-04-12 13:23:26 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Output of guestfish -a /dev/mapper/vg_trick-Windows7x32 -m /dev/sda2 -v (23.61 KB, text/plain)
2009-12-14 13:56 EST, Richard W.M. Jones
no flags Details
Output of guestfish -a /dev/mapper/vg_trick-Windows7x32 -m /dev/sda2 -v (1.32 MB, text/plain)
2009-12-14 14:09 EST, Richard W.M. Jones
no flags Details

  None (edit)
Description Richard W.M. Jones 2009-12-14 13:56:00 EST
Created attachment 378305 [details]
Output of guestfish -a /dev/mapper/vg_trick-Windows7x32 -m /dev/sda2 -v

Description of problem:

[This is really a bug in NTFS-3g]

Freshly installed Windows 7 has two partitions, /dev/sda1 is the
boot partition and /dev/sda2 is the C: drive.  However if the
guest is running then the NTFS-3g mount command has a lot of
trouble mounting the C: drive:

  guestfish -a /dev/mapper/vg_trick-Windows7x32 -m /dev/sda2 -v

(lengthy output attached)

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

guestfish 1.0.79

How reproducible:

Always on my local machine, but not observed with other
versions of Windows.

Steps to Reproduce:
1. Install Windows 7.
2. Make sure the Windows 7 guest is running.
3. guestfish -a Windows7.img -m /dev/sda2 -v
Actual results:

Cannot mount C: drive.

Expected results:

Either it should be able to mount the disk, or it should give
an error message in a reasonable amount of time.

Additional info:

It works fine if the Windows 7 guest is shut down beforehand.
Comment 1 Richard W.M. Jones 2009-12-14 14:02:18 EST
Comment on attachment 378305 [details]
Output of guestfish -a /dev/mapper/vg_trick-Windows7x32 -m /dev/sda2 -v

Well, as you can see, this doesn't happen all the time.  The log file was perfect that time, and unfortunately I didn't capture the log where it broke, and now I can't reproduce it!
Comment 2 Richard W.M. Jones 2009-12-14 14:09:21 EST
Created attachment 378312 [details]
Output of guestfish -a /dev/mapper/vg_trick-Windows7x32 -m /dev/sda2 -v

Here's a real log of a failure.

What's happening is I'm not specifying the --ro option, so it
tries to mount the partition read/write.  In this instance *only*
this should be OK, because the underlying disk image is read-only
for non-root users, so qemu will open the block device read-only.

However NTFS-3g tries to fix the disk (which it thinks was mounted
uncleanly), causing it to try to write to the block device.

qemu refuses these writes, giving virtual IDE errors.

The solution for libguestfs programs is you should do the add
and mount commands read-only or specify the --ro option.

The solution for NTFS-3g is it shouldn't keep trying to write
to a read-only IDE device.
Comment 3 Richard W.M. Jones 2009-12-14 14:36:52 EST
Posted upstream:
(at time of writing, message has not appeared)
Comment 5 Richard W.M. Jones 2011-04-12 13:23:26 EDT
Should be using the --ro option, which overlays a snapshot
device and thus allows writes (discarding them later).

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