Mounting an Android VMDK with no external libraries
Matthew Barrera
I have a VMDK file and when I run mount Android-img.vmdk /mnt/android/ I get wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error. I have searched around and I see a lot of solutions that involve external libs, but I have to do it without downloading anything extra. I did run ls /sbin/mount* and got:
/sbin/mount.cifs
/sbin/mount.exfat-fuse
/sbin/mount.lowntfs-3g
/sbin/mount.nfs4
/sbin/mount.ntfs-3g
/sbin/mount.vboxsf
/sbin/mount.exfat
/sbin/mount.fuse
/sbin/mount.nfs
/sbin/mount.ntfs
/sbin/mountstats
/sbin/mount.vmhgfs 1 Answer
I've used this method to mount VMs from QEMU, Virtualbox, and VMware. First, install this:
sudo apt install qemu-utilsThen load the driver and mount the image to a loop device:
sudo modprobe nbd
sudo qemu-nbd --connect=/dev/nbd0 /path/to/your/image-fileIf it's working, you should see something like this (the following is from a Ubuntu VM):
$ sudo fdisk -l /dev/nbd0
Disk /dev/nbd0: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C6425F6B-6DB0-4E64-BA60-BF958383F4AD
Device Start End Sectors Size Type
/dev/nbd0p1 2048 1050623 1048576 512M EFI System
/dev/nbd0p2 1050624 52955135 51904512 24.8G Linux filesystem
/dev/nbd0p3 52955136 104855551 51900416 24.8G Linux filesystemNow, mount the partition as usual - either with your file manager or from the terminal like this:
sudo mount /dev/nbd0p2 /mntOnce you're done, unmount the partition and unload the driver:
sudo sync
sudo umount /dev/nbd0p2
sudo qemu-nbd --disconnect /dev/nbd0
sudo modprobe -r nbd 2