Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mounting VMDK disk image

I have a single vmware disk image file with vmdk extension

I am trying to mount this and explore all of the partitions (including hidden ones).

I've tried to follow several guides, such as : http://forums.opensuse.org/showthread.php/469942-mounting-virtual-box-machine-images-host

I'm able to mount the image using vdfuse

vdfuse -w -f windows.vmdk /mnt/ 

After this I can see one partition and an entire disk exposed

# ll /mnt/ total 41942016 -r-------- 1 te users 21474836480 Feb 28 14:16 EntireDisk -r-------- 1 te users  1569718272 Feb 28 14:16 Partition1 

Continuing with the guide I try to mount either EntireDisk or Partition1 using

mount -o loop,ro /mnt/Partition1 mnt2/ 

But that gives me the error 'mount: you must specify a filesystem type'

In trying to find the correct type I tried

dd if=/mnt/EntireDisk | file - which outputs a ton of information but of note is: /dev/stdin: x86 boot sector; partition 1: ....... FATs .... 

So i tired to mount as a vfat but that gave me

mount: wrong fs type, bad option, bad superblock ...etc 

What am I doing wrong?

like image 210
Without Me It Just Aweso Avatar asked Mar 11 '14 13:03

Without Me It Just Aweso


People also ask

How do I mount a VMDK image?

Open VMware Workstation for Linux and go to File > Mount Virtual Disks. Hit Mount Disk, the pop-up window is opened after that. Click Browse and select the virtual disk VMDK file. Let's select the VMDK file of the second differential virtual disk created after taking the second VM snapshot.

How do I mount a VMware disk?

To run VMware Disk Mount, open a command prompt on a Windows host. The Disk Mount utility installs in C:\Program Files\VMware\VMware Virtual Disk Development Kit\bin by default, which the installer adds to your search path, so you can probably type just vmware-mount to run the utility.


1 Answers

For newer Linux systems, you can use guestmount to mount the third partition within a VMDK image:

guestmount -a xyz.vmdk -m /dev/sda3 --ro /mnt/vmdk 

Alternatively, to autodetect and mount an image (less reliable), you can try:

guestmount -a xyz.vmdk -i --ro /mnt/vmdk 

Do note that the flag --ro simply mounts the image as read-only; to mount the image as read-write, just replace it with the flag --rw.

Installation

guestmount is contained in following packages per distro:

  • Ubuntu: libguestfs-tools
  • OpenSuse: guestfs-tools
  • CentOS / Fedora: libguestfs-tools-c

Troubleshooting

error: could not create appliance through libvirt

$ guestmount -a file.vmdk -i --ro /mnt/guest libguestfs: error: could not create appliance through libvirt.  Try running qemu directly without libvirt using this environment variable: export LIBGUESTFS_BACKEND=direct  Original error from libvirt: Cannot access backing file '/path/to/file.vmdk' of storage file '/tmp/libguestfssF6WKX/overlay1.qcow2' (as uid:107, gid:107): Permission denied [code=38 int1=13] 

Solution: use LIBGUESTFS_BACKEND=direct, as suggested:

LIBGUESTFS_BACKEND=direct guestmount -a file.vmdk -i --ro /mnt/guest 

fusermount: user has no write access to mountpoint

LIBGUESTFS_BACKEND=direct guestmount -a file.vmdk -i --ro /mnt/guest/ fusermount: user has no write access to mountpoint /mnt/guest libguestfs: error: fuse_mount failed: /mnt/guest/, see error messages above 

Solution: use sudo, or change file permissions on the mountpoint

like image 188
Thomas Avatar answered Sep 23 '22 03:09

Thomas