Mounting a multipart vmdk disk on Linux

There are many ways to do that, one of which is using the tools provided by vmware to combine the disks into one and then mounting it with

kpartx -av mydisk.vmdk;

Then

mount -o /dev/mapper/loop0p1 /hds/disk

While another method, which is simpler

apt-get install qemu-utils
qemu-img convert disk-s001.vmdk s01.raw
....
qemu-img convert disk-s013.vmdk s13.raw
....
qemu-img convert disk-s032.vmdk s32.raw

The above will be sparse files, so you will not have disk usage as big as the file, a “df -h” should not result in any lost of disk space beyond the data that is used by files in the image

following the above, we need to combine the RAW files like so

cat s01.raw s02.raw s03.raw s04.raw s05.raw s06.raw s07.raw s08.raw s09.raw s10.raw s11.raw s12.raw s13.raw s14.raw s15.raw s16.raw s17.raw s18.raw s19.raw s20.raw s21.raw s22.raw s23.raw s24.raw s25.raw s26.raw s27.raw s28.raw s29.raw s30.raw s31.raw s32.raw > combined.raw
losetup /dev/loop0 combined.raw
kpartx -a /dev/loop0
mount /dev/mapper/loop0p1 /hds/img1

2 thoughts on “Mounting a multipart vmdk disk on Linux

  1. THANK YOU !!!

    it worked like charm. My .vmdk file was corrupted and I only had the -sxx.vdmk ones, with your tutorial I was able to mount it and get all my work back.

    cheers,
    Andre

  2. Thank you for your article. qemu-img now knows what to do with multipart vmdks and you can just run as follows:

    qemu-img convert -p disk.vmdk combined.raw

    Also of note, if your disk image has multiple partitions and you do not have kpartx handy, you can use fdisk and a bit of math:

    fdisk -l combined.raw

    Device Boot Start End Sectors Size Id Type
    combined.raw1 * 2 999999 2000 1G 83 Linux

    losetup -o 1024 /dev/loop0 combined.raw # 1024 = 2(Start)*512
    mount /dev/loop0 /hds/img1

Leave a Reply

Your email address will not be published. Required fields are marked *