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/
# ll /mnt/ total 41942016 -r-------- 1 te users 21474836480 Feb 28 14:16 EntireDisk -r-------- 1 te users 1569718272 Feb 28 14:16 Partition1
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 .
mount: wrong fs type, bad option, bad superblock . etc
Did you try ntfs? Did you try fdisk /mnt/EntireDisk or gparted /mnt/EntireDisk and looking at the partitions there? Do they show up correctly?
fdisk returned: ‘WARNING: GPT detected on ‘. ‘. The util fdisk doesnt support GPT’. gparted is able to show me there are 4 partitions but all fail to initalize. It lists several required packages for ntfs and fat32 that i might need so I’ll install those and see if it gets me anything
Also, you might want to move this question over to serverfault.com, I bet you would get more help there as this isn’t really a software dev or computer science question.
I saw a lot of solution, but finally I use the simple solution: add the VMDK file to an existed linux VM. Boot to that VM and mount the partition normally. You can use GUI tool to mount (such as gnome-disks in gnome) or mount command line
6 Answers 6
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
Vmware mount disk linux
You are using an outdated browser. Please upgrade your browser to improve your experience.
When you map a virtual disk and its associated volume to a drive on the host system, you can connect to the virtual disk without opening a virtual machine.
After you map the virtual disk to a drive on the host system, you cannot power on any virtual machine that uses the disk until you disconnect the disk from the host system.
Important: If you mount a virtual disk that has a snapshot and then write to the disk, you can irreparably damage a snapshot or linked clone created from the virtual machine. Note that Workstation Player does not support taking snapshots or deleting them.
Mapping a virtual disk to a host system is not supported in the standalone version of Workstation Player . Virtual disk mapping is supported in the Workstation Player version included with Workstation Pro.
Prerequisites
- Power off all virtual machines that use the virtual disk.
- Verify that the virtual disk ( .vmdk ) files on the virtual disk are not compressed and do not have read-only permissions.
- Verify that the virtual disk is unencrypted. You cannot map or mount encrypted disks.
Procedure
- Select the virtual machine and select Virtual Machine > Virtual Machine Settings .
- On the Hardware tab, select Hard Disk , click Utilities , and select Map .
- On a Linux host, select the Mount in read-only mode check box in the Mount Disk dialog box.
This setting prevents you from accidentally writing data to a virtual disk that might be the parent of a snapshot or linked clone. Writing to such a disk might make the snapshot or linked clone unusable.
The drive appears on the host system. You can read from or write to files on the mapped virtual disk on the host system.
Overview
vmdk ’s, the underlying filesystem commonly used in vmware , can be mounted on a Linux server using the qemu utilities. In this example, I downloaded an ova , unarchived it, and retrieved the vmdk files. Once exposed, I am able to mount the filesystems embedded within the vmdk .
In this example, the ova is a virtual “appliance” which prohibits access a low level root shell. By mounting the vmdk file system directly, we can take a peek at the hidden secrets the vendor keeps under lock and key.
Details
sudo apt install qemu-utils
Load the network block device module:
jemurray@home-server:~/ib$ sudo modprobe nbd
Create the network block devices from the vmdk image:
jemurray@home-server:~/ib$ sudo qemu-nbd -r -c /dev/nbd1 ./vnios-disk.vmdk
Examine the images qemu created:
jemurray@home-server:~/ib$ ls -al /dev/nbd1p* brw-rw---- 1 root disk 43, 33 Jan 9 14:28 /dev/nbd1p1 brw-rw---- 1 root disk 43, 34 Jan 9 14:28 /dev/nbd1p2 brw-rw---- 1 root disk 43, 35 Jan 9 14:28 /dev/nbd1p3 brw-rw---- 1 root disk 43, 36 Jan 9 14:28 /dev/nbd1p4 brw-rw---- 1 root disk 43, 37 Jan 9 14:28 /dev/nbd1p5 brw-rw---- 1 root disk 43, 38 Jan 9 14:28 /dev/nbd1p6 brw-rw---- 1 root disk 43, 39 Jan 9 14:28 /dev/nbd1p7
Create mount points for the new filesystems:
jemurray@home-server:~/ib$ mkdir p1 jemurray@home-server:~/ib$ mkdir p2 jemurray@home-server:~/ib$ mkdir p3 jemurray@home-server:~/ib$ mkdir p4 jemurray@home-server:~/ib$ mkdir p5 jemurray@home-server:~/ib$ mkdir p6 jemurray@home-server:~/ib$ mkdir p7
Attempt to mount each individual directory:
jemurray@home-server:~/ib$ sudo mount /dev/nbd1p1 ./p1 mount: /home/jemurray/ib/p1: WARNING: device write-protected, mounted read-only. jemurray@home-server:~/ib$ sudo mount /dev/nbd1p2 ./p2 mount: /home/jemurray/ib/p2: WARNING: device write-protected, mounted read-only. jemurray@home-server:~/ib$ sudo mount /dev/nbd1p3 ./p3 NTFS signature is missing. Failed to mount '/dev/nbd1p3': Invalid argument The device '/dev/nbd1p3' doesn't seem to have a valid NTFS. Maybe the wrong device is used? Or the whole disk instead of a partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around? jemurray@home-server:~/ib$ sudo mount /dev/nbd1p4 ./p4 mount: /home/jemurray/ib/p4: WARNING: device write-protected, mounted read-only. jemurray@home-server:~/ib$ sudo mount /dev/nbd1p5 ./p5 mount: /home/jemurray/ib/p5: WARNING: device write-protected, mounted read-only. jemurray@home-server:~/ib$ sudo mount /dev/nbd1p6 ./p6 mount: /home/jemurray/ib/p6: WARNING: device write-protected, mounted read-only. jemurray@home-server:~/ib$ sudo mount /dev/nbd1p7 ./p7 mount: /home/jemurray/ib/p7: unknown filesystem type 'swap'.
jemurray@home-server:~/ib/p1$ ls -al total 104 drwxr-xr-x 23 root root 4096 Oct 8 12:42 . drwxrwxr-x 9 jemurray jemurray 4096 Jan 9 14:31 .. drwxr-xr-x 2 root root 4096 Oct 8 12:41 bin drwxr-xr-x 4 root root 4096 Oct 8 12:42 boot drwxr-xr-x 4 root root 4096 Oct 8 12:41 dev drwxr-xr-x 29 root root 4096 Oct 8 12:42 etc drwxr-xr-x 2 root root 4096 Oct 8 12:41 home drwxr-xr-x 7 root root 4096 Oct 8 12:42 lib drwx------ 2 root root 16384 Oct 8 12:58 lost+found drwxr-xr-x 5 root root 4096 Oct 8 12:41 media drwxr-xr-x 2 root root 4096 Oct 8 12:41 mnt
Mount VMWare Disk Images Under Linux
Is it still possible to mount VMWare disk images under Linux? I found the following two articles, both of them recommend to use kpartx -av diskimage-flat.vmdk . However both the articles are old and, when I try it on my Ubuntu Utopic 14.10, it no longer works any more.
$ sudo kpartx -av MyWin81.vmdk $ sudo ls /dev/mapper/loop* | wc -l ls: cannot access /dev/mapper/loop*: No such file or directory 0
Disclosure: My VMWare disk image IS a flat disk image. Furthermore (before you recommend loop mount), it is a multi-partition disk image, with first partition being Window8 and next two in Linux. It is the next two Linux partitions that I’m more interested to work on. Can someone confirm please? Thanks. Mount Flat VMWare Disk Images Under Linux http://cromoteca.com/en/blog/mountflatvmwarediskimagesunderlinux/ Mount a VMware virtual disk (.vmdk) file on a Linux box http://www.commandlinefu.com/commands/view/12554/mount-a-vmware-virtual-disk-.vmdk-file-on-a-linux-box UPDATE: vmware-mount looks very promising, but I can’t get it working yet:
$ vmware-mount -p Win81.vmdk VixDiskLib: Invalid configuration file parameter. Failed to read configuration file. Nr Start Size Type Id Sytem -- ---------- ---------- ---- -- ------------------------ 1 2048 78643200 BIOS 7 HPFS/NTFS 2 78645248 6039552 BIOS 83 Linux 3 84684800 41144320 BIOS 83 Linux % vmware-mount Win81.vmdk 1 /mnt/tmp1/ VixDiskLib: Invalid configuration file parameter. Failed to read configuration file. Failed to mount partition 1 of disk 'Win81.vmdk' on '/mnt/tmp1/': Insufficient permissions to perform this operation % vmware-mount -L VixDiskLib: Invalid configuration file parameter. Failed to read configuration file. No mounted disks. $ vmware-mount | head -3 VixDiskLib: Invalid configuration file parameter. Failed to read configuration file. VMware DiskMount Utility version 6.0.0, build-2496824 Usage: vmware-mount diskPath [partition num] mountPoint
NB, the 2nd and 3rd command is run directly as root , yet I get «Insufficient permissions to perform this operation«?