2

I am trying to mount an encrypted (TrueCrypt/VeraCrypt) volume from inside a .vmdk file (VMware disk). Is there any tool in Windows (7 through 10) or a third-party tool that'd let me attach the disk in order for the Volume Manager to discover the volumes on it, such that TrueCrypt/VeraCrypt subsequently show these volumes for selection?

Please note that I'm aware of the ability to mount volumes from inside a .vmdk file. But this is not what I am asking. Because the mounting has to be done by TrueCrypt/VeraCrypt I need to be able for these programs to "see" the volume. So the .vmdk should be made available in a similar fashion to how any partitioned physical disk would be made available ("attached") to a Windows system.


Of course I am referring to the kpartx -a ... functionality.

0xC0000022L
  • 7,544
  • 10
  • 54
  • 94

3 Answers3

2

NB: since I placed a bounty I'll gladly award the bounty to anyone who can provide a functional alternative to what I am demonstrating in my answer below (commercial or not). Because the reputation gets subtracted from me either way.


Out of the four solutions linked by harrymc in a comment (thanks!), I had already tried the first three. The fourth, a freeware called OSFMount also didn't help me. What's worse, the linked article uses misleading terminology:

[...] here are 4 ways to get it mounted in Windows as a disk drive.

The proper terminology would be to get it mounted as a volume. In fact the mounting part implies that. Roughly one could say that disks get attached, while volumes (== partitions on disks) get mounted. But my guess is that due to the fact that terminology varies between OSs and not everyone is a kernel mode developer with knowledge about the Windows storage driver architecture terminology has gotten fuzzy.

The shell extension installed by VMware calls it Map Virtual Disk, although it would be more aptly named Mount Volume inside Virtual Disk (or similar). Besides, the context menu (via shell extension) only provides an alternative route to the second presented solution, which uses the VMware Workstation GUI to invoke the dialog to Map Virtual Disks.

Regardless, terminology is key here. Which is also why it took so long to come up with a result for this question. Too many people use misleading terminology, which "pollutes" search results.

However, since I placed a bounty, I also researched anew if there was a solution. I ended up on the excellent reboot.pro forum in this thread and from there found a mentioning of Arsenal Image Mounter. Apparently written, in large parts, by Olof Lagerkvist of LTR Data (creator of ImDisk), Arsenal Image Mounter includes a storport driver, which is exactly the thing I was looking for.

The steps were:

  1. Installing the driver
  2. ... and using ArsenalImageMounter.exe from an older revision

... allowed to attach the VMDK file as a SCSI disk to Windows. This also caused the volumes to be auto-mounted (much like is done when you attach a partitioned USB disk), but the important part was that the volume was now visible to VeraCrypt for mounting.

This satisfies the requirements I put up in my question.

The steps in screenshots looked as follows (after installing the Arsenal Image Mounter driver):

Options before the disk gets attached

(Terminology here is also a bit fuzzy, because this tool apparently provides both attaching an image file as SCSI disk and mounting volumes therein.)

Image file attached as SCSI disk

And the result in the disk management snap-in of Windows 10 looks like this:

Windows 10 disk management

The relevant parts are that Disk 3 is the (VMDK) image file appearing as actual disk to the system and VeraCrypt is able to see that RAW volume which had been automatically assigned the drive letter H: (and subsequently opened up the dialog to format said volume). The relevant parts are highlighted in the last screenshot.

0xC0000022L
  • 7,544
  • 10
  • 54
  • 94
2

You can approach this problem from the other direction, as phuclv commented.

Basically:

  • Windows natively supports attaching VHDs as disks. These behave just like any physical disk.
    • This means VeraCrypt can see them as just another disk.
  • It's possible to convert VMDK disks into VHD disks (and vice-versa).
    • Additionally, recent versions of VMware Workstation let you directly use a VHD disk, though you do lose its Defragment/Compact functionality.

So a possible solution, completely avoiding third-party tools, is to use VHD as your virtual disk format and attach it natively in Windows.


You'll want to make sure you only have the disk attached in one place at a time, i.e. detach from Windows before booting the VM, and shut down the VM before attaching on Windows. Doing otherwise is ... a bad idea.

  1. To start with, you need to get a VHD. If you do not have any existing disk, you can create one through the Disk Management => Action => Create VHD menu option. Alternatively, the diskpart create command does the same thing.

    Screenshot of Disk Management menu

    If you have an existing VMDK you want to use, you can convert it using a PowerShell module provided by Microsoft. Some more step-by-step instructions here.

  2. Assuming you still want to attach the disk in VMware, you'll need to remove the old storage device with the VMDK disk and add a new storage device (preferably on the same controller type) with an "existing disk" pointing towards the VHD disk. You will need to select "All Files" in the browse dialog, otherwise it will only show VMDK files. Now, on the VMware side, everything should work more or less as it did with the VMDK disk.

  3. Now you just need to attach the VHD on Windows' side. You can again do this from the Disk Management => Action => Attach VHD menu, or using diskpart attach.

  4. VeraCrypt should now see these disks. They should be indistinguishable from a physical disk.

    Screenshot of Disk Management and VeraCrypt

Bob
  • 63,170
0

An alternative solution is via the donation-ware of ImDisk virtual disk driver.

Use ImDisk for mounting vmdk as follows :

  • After installation you will find the ImDISK Virtual Disk Driver in the Windows Control Panel.
  • Click File / Mount new virtual disk
  • Select the vmdk file and a drive letter and click OK
  • The disk is now available in Windows.
  • If Windows asks to format the disk, click Cancel

I have the tested the procedure on Windows 10 64-bit and it seems to work, even though the release dates from August 2016.

harrymc
  • 498,455