When we powered off VMs through vCenter prior to exporting/importing,
sometimes it would complain about failing to mount /dev/sda2:
Failed to mount '/dev/sda2': Operation not permitted
The NTFS partition is in an unsafe state. Please resume and shutdown
Windows fully (no hibernation or fast restarting), or mount the volume
read-only with the 'ro' mount option.
ocaml_exn: 'mount' raised 'Failure' exception
guestfsd: error: mount exited with status 14: The disk contains an unclean
file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Failed to mount '/dev/sda2': Operation not permitted
The NTFS partition is in an unsafe state. Please resume and shutdown
Windows fully (no hibernation or fast restarting), or mount the volume
read-only with the 'ro' mount option.
guestfsd: => mount (0x1) took 0.03 secs
libguestfs: trace: v2v: mount = -1 (error)
virt-v2v: error: unable to mount the disk image for writing. This has
probably happened because Windows Hibernation or Fast Restart is being used
in this guest. You have to disable this (in the guest) in order to use
virt-v2v.
After this, we started always shutting off the VMs inside the Guest OS via
shift-shutdown. This resolved the error above.
However, the guests do not support Hibernate / Fast Shutdown:
PS C:\WINDOWS\system32> powercfg /a
The following sleep states are not available on this system:
Standby (S1)
An internal system component has disabled this standby state.
Graphics
Standby (S2)
The system firmware does not support this standby state.
An internal system component has disabled this standby state.
Graphics
Standby (S3)
The system firmware does not support this standby state.
An internal system component has disabled this standby state.
Graphics
Hibernate
The system firmware does not support hibernation.
Standby (S0 Low Power Idle)
The system firmware does not support this standby state.
Hybrid Sleep
Standby (S3) is not available.
Hibernation is not available.
Fast Startup
Hibernation is not available.
Thanks!
- Alan
On Fri, Jun 18, 2021 at 6:27 AM Richard W.M. Jones <rjones(a)redhat.com>
wrote:
Thanks for sending the disk image across.
With latest libguestfs and guestfs-tools I am able to inspect the image
fine:
$ rpm -q guestfs-tools libguestfs
guestfs-tools-1.47.2-1.fc35.x86_64
libguestfs-1.45.6-6.fc35.x86_64
$ tar xf SoftdriveTest.ova SoftdriveTest2-disk1.vmdk
$ virt-inspector -a SoftdriveTest2-disk1.vmdk
<?xml version="1.0"?>
<operatingsystems>
<operatingsystem>
<root>/dev/sda2</root>
<name>windows</name>
<arch>x86_64</arch>
<distro>windows</distro>
<product_name>Windows 10 Home</product_name>
<product_variant>Client</product_variant>
<major_version>10</major_version>
<minor_version>0</minor_version>
<windows_systemroot>/Windows</windows_systemroot>
<windows_current_control_set>ControlSet001</windows_current_control_set>
<osinfo>win10</osinfo>
<mountpoints>
<mountpoint dev="/dev/sda2">/</mountpoint>
</mountpoints>
...
Recent virt-v2v gets further, but hits an issue because the guest is
using Fast Restart:
$ rpm -q virt-v2v
virt-v2v-1.45.1-1.fc35.x86_64
$ virt-v2v -i ova SoftdriveTest.ova -o null
[ 0.0] Opening the source -i ova SoftdriveTest.ova
[ 166.6] Creating an overlay to protect the source from being modified
[ 166.7] Opening the overlay
[ 173.0] Inspecting the overlay
virt-v2v: error: filesystem was mounted read-only, even though we asked
for
it to be mounted read-write. This usually means that the filesystem was
not cleanly unmounted. Possible causes include trying to convert a
guest
which is running, or using Windows Hibernation or Fast Restart.
(
https://libguestfs.org/virt-v2v.1.html#windows-8-fast-startup-is-incompat...
)
Looking at the detailed log, the inspection step was fine. Therefore
I think it should work fine if Fast Restart was disabled before conversion.
I went back to the old version of libguestfs you're using (1.40)
virt-inspector shows pretty similar output to your virt-v2v log.
However when I looked closer I found that guestfish cannot mount the
/dev/sda2 partition from this disk at all. I'm not at all clear why.
I guess it might be fast restart or something else (too old ntfs-3g?)
Anyway since it works with recent libguestfs/virt-v2v, I would suggest
upgrading to a later version and disabling Fast Restart in Windows
guests before conversion, which together should solve the problem.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top