Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

(Windows 7, TrueCrypt v7.1a)

I use a batch file to mount two TrueCrypted disks when needed. On my old motherboard, the devices were initialized in constant order, and I could use

truecrypt.exe /volume \Device\HardDisk2\Partition1 [...]
truecrypt.exe /volume \Device\HardDisk3\Partition1 [...]

However, my new motherboard doesn't guarantee the order of initialization, and the above no longer works. I can use the volume name to mount one of the disks...

truecrypt.exe /volume \\?\Volume{501c1635-ff75-11e1-bbd4-806e6f6e6963}\ [...]

... but, for some reason, the other disk doesn't present a name. Here's the output of mountvol.exe with both drives dismounted :



    *** NO MOUNT POINTS ***



C:, D:, and E: are all native NTFS partitions, F: is a DVD-RW. The '* * * NO MOUNT POINTS * * *' maps to one of the Truecrypt drives, and the other doesn't appear at all. However, after mounting both drives via the GUI, mountvol.exe now shows (in addition to the above)



Here's what diskpart.exe has to say for itself (both disks unmounted) :

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online           59 GB  1024 KB
  Disk 1    Online          465 GB  1024 KB        *
  Disk 2    Online         1863 GB      0 B
  Disk 3    Online         1397 GB      0 B

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     F                       DVD-ROM         0 B  No Media
  Volume 1     C                NTFS   Partition     24 GB  Healthy    System
  Volume 2     D                NTFS   Partition     35 GB  Healthy
  Volume 3     E                NTFS   Partition    465 GB  Healthy
  Volume 4                      RAW    Partition   1397 GB  Healthy

Where Disk 3/Volume 4 is the device that does present a volume name, and Disk 2 the device that doesn't.

And the Windows Disk Management console, when asked about the (unmounted) mystery drive, says :

Volume = (null)
Layout = Simple
Type = Basic
File System = (null)
Status = Healthy (Primary Partition)
Capacity = 1863.01GB
Free Space = 1863.01GB
%Free = 100%

How can I refer to this drive when using truecrypt.exe to mount via a batch file?

TL;DR : How can I mount a TrueCrypt disk via a batch file/command line, when I cannot use either the '\Device\HardDisk#\Partition#' or '\?\Volume{* - * - * - * - *}\' forms of identification? TrueCrypt's GUI's 'Select Device and Mount...' works fine, but I want to be able to mount this via a batch file. How? I seem to remember reading something about changing the partition type byte, but I'm understandably wary about that. Could someone talk me through it?

share|improve this question

After shuffling around and backing up 2Tb of data, I managed to succeed.

You'll need a known good Type ID, either from somewhere like , or from a working TrueCrypt partition. In order to be safe(r), I took the Type ID from my other, working, TrueCrypt drive like so :

Using DiskPart.exe

SELECT DISK [known good TrueCrypt drive #]
SELECT PARTITION [known good TrueCrypt partition #]

Take note of the hex number in the 'Type' field. Mine was 06.

Back into DiskPart to set the ID on the bad drive

SELECT DISK [bad TrueCrypt drive #]
SELECT PARTITION [bad TrueCrypt partition #]
SET ID=[known good Type ID] OVERRIDE

Wait for a few heart-stopping moments, as DiskPart decides whether or not to destroy years of work and data, and you should see

DiskPart successfully set the partition ID

and MountVol.exe should now list the drive with the expected '* * * NO MOUNT POINTS * * *' message. Henceforth, you can now use the \ \?\Volume{...} name to access this TrueCrypt partition via the command line.

Note : As I mentioned, this was successful for me, but since I didn't know what I was doing, I make no guarantees.

share|improve this answer
Hi! To have your accounts merged, please visit this help site and follow the procedure there: (Hint: Using a non-throwaway e-mail address and registering the account helps in these cases of cookie loss) – slhck Feb 12 '13 at 21:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .