PDA

View Full Version : Mount .img file created by Virtual Machine Manager.



action_owl
19th January 2010, 09:21 AM
I have a file that was created in Virtual Machine Manager and I need to get it out of the virtual operating system(windowsXP). Writing to a USB would be ideal but that hasn't been working since I upgraded to Fedora12.

Is there anyway I can mount the image to retrieve the file?

I thought this would work:

mount -o loop -t iso9660 /var/lib/libvirt/images/WindowsXP2.img /mnt/windows

mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so


mounting as fvat doesn't work either.

diamond_ramsey
19th January 2010, 09:49 AM
:) action_owl, thank you for your post. :)


...
mount -o loop -t iso9660 /var/lib/libvirt/images/WindowsXP2.img /mnt/windows

mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so
...

=========================================

Any useful data in the end of dmesg? If so, then please post. :)

=========================================

file /var/lib/libvirt/images/WindowsXP2.img

ls -lZ /var/lib/libvirt/images/WindowsXP2.img

"Display what the system thinks this file is and try mounting"

=========================================

gunzip -c /var/lib/libvirt/images/WindowsXP2.img > /tmp/test.img

file /tmp/test.img

"Display what the system thinks this file is and try mounting" For example,

mount -t iso9660 /tmp/test.img /mnt/ -o loop

=========================================

Possibly a good peruse of these URLs may be useful for your file. :)

Accessing Data on a Disk Image -

https://wiki.gridx1.ca/twiki/bin/view/Main/BuildingXenImagesWithRedhatTools#Accessing_Data_on _a_Disk_Image

19.11. Accessing Data on Guest Disk Image -

https://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Virtualization-en-US/virt-install-wizard.html

=========================================

Hope this helps. ;)

action_owl
19th January 2010, 10:52 AM
Wow, Thank you,

This is what got me access to the image.
Your URL even had the named anchor to the relevant section!

https://wiki.gridx1.ca/twiki/bin/view/Main/BuildingXenImagesWithRedhatTools#Accessing_Data_on _a_Disk_Image


Most of this is covered at RHEL Virtualization Guide. First find an available loop device
losetup -f
and associate the image file with a loop device
losetup /dev/loop# /path/to/disk_image.img .
Next create a device map from the partition table
kpartx -av /dev/loop#
To access just the /boot/ directory on the image
mount -o loop /dev/mapper/loop#p1 /mnt
Otherwise, scan for volume groups

Thanks again

diamond_ramsey
19th January 2010, 11:41 PM
:) action_owl, thank you for your post. :)


Wow, Thank you,

This is what got me access to the image.
Your URL even had the named anchor to the relevant section!

https://wiki.gridx1.ca/twiki/bin/view/Main/BuildingXenImagesWithRedhatTools#Accessing_Data_on _a_Disk_Image...

:p Most excellent!!! :p

I was thinking that this would be the preferred option and presented both options for thought. :)

There is so much power in these commands as well as other commands which we will discover. I am quite pleased to find out about the losetup and kpartx command set. :)

Glad this could help. ;)