Bug 547479

Summary: NTFS partitions sometimes fail to mount if mounted read/write
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED NOTABUG QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: mbooth, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-12 17:23:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Output of guestfish -a /dev/mapper/vg_trick-Windows7x32 -m /dev/sda2 -v
none
Output of guestfish -a /dev/mapper/vg_trick-Windows7x32 -m /dev/sda2 -v none

Description Richard W.M. Jones 2009-12-14 18:56:00 UTC
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 19:02:18 UTC
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 19:09:21 UTC
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 19:36:52 UTC
Posted upstream:
http://sourceforge.net/mailarchive/forum.php?forum_name=ntfs-3g-devel
(at time of writing, message has not appeared)

Comment 5 Richard W.M. Jones 2011-04-12 17:23:26 UTC
Should be using the --ro option, which overlays a snapshot
device and thus allows writes (discarding them later).