I have the exported disk image of a VM from XenCenter in VHD format. I used compress from the settings, if that has any impact. How I can access the files without creating VM? I have the VM settings as well the disk. Fdisk can read the image but it does not lists any partitions. I don't care about the system itself, only the files. More notably /etc and /home.

VM was created in XenServer 6.2 (if I recall correctly) and it's using LVM. Later as I upgraded to Debian 8 I also upgraded XenServer to 6.5 and installed SP1. I must note that hard drive of XenXerver got corrupted but before doing the export guest OS worked without problems. I'm fairly positive the image I have is functional.

What I have tried so far:

  • Importing the VM into new master (different hardware). It failed to import. As it takes around 10 hours to do this, I'm not very keen to try this any more.
  • Importing the VM into old master (same hardware)
  • Importing the VM into new master (same hardware)
  • Converted VHD into VDI and mounted it to VirtualBox. It failed saying no bootable media found. Reason for convert is that VirtualBox didn't allow mounting VHD directly.
  • Tried to install new VM where I used virtualbox-fuse to mount it. But it sayd that VHD is in unknown format.
  • Tried to use losetup to pass boot sector of image and then mount it. But it can not find filesystem while mounting. At least ext4 or ext2.
  • Tried to attach VHD into Windows machine. It says it's either corrupted or unreadable.

There might be something else I have tried but I don't recall right now. I'm totally helpless right now.


you'll need a number of steps to mount & read the image. Firstly convert VHD to RAW

qemu-img convert -f vmdk -O raw myfile.vhd myfile.img

The original file will of course stay intact. Next you will have to mount the file. For this there are several steps involved

Firstly, connect the raw image to a loopback device.

losetup /dev/loop0 myfile.img

If I have understood correctly you are using a logical volume. This means you can't mount it directly but you find & active the volume group per


vgchange -ay YourVG

If lvs doesn't find your volume, you will have to change the lvm filter in


and set it to

filter = [ "a/.*/" ]

with that done you can mount the logical volume.

mount /dev/mapper/lvol01 /mnt

Hope this was helpful.

| improve this answer | |
  • I didn't get this method to work. When trying the convert it says "qemu-img: Could not open 'disk.vhd': Invalid argument. Then I did look into man page of qemu-img and it says that if format is not given it will try to guess it. I dropped the -f parameter and it started to convert it. Ok. Next I did run losetup and it returned instantly without error. But lvs only shows the current LV's on the running OS. I did check the filter and it seems to default what you suggested. – user715517 Sep 23 '15 at 7:40
  • Hi, try changing the default to include the loopback devices. And try vgs. The Volume group may be inactive. – Eamonn Travers Sep 23 '15 at 8:19
  • Can you mount the loopback directly? – Eamonn Travers Sep 23 '15 at 8:27
  • I did modify filter = ["a/.*/", "a/loop/", "r/.*/"]. Tho a/.*/ should already include loopback devices. After restart on LVM it did not help. Trying to mount the loop (mount /dev/loop0 /mnt/disk/) resulted: VFS: Can't find ext4 filesystem. And same for ext2. – user715517 Sep 23 '15 at 9:19
  • I'm afraid I'm flummoxed. What does fdisk -l say about the image? – Eamonn Travers Sep 23 '15 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.