90

I've started using TrueCrypt to encrypt a partition on an external USB hard drive. I've opted for using a raw partition as opposed to a file container.

But here's the annoyance. Whenever I connect this drive to a computer running Vista or Windows 7, I get the message popup "You need to format the disk in drive J: before you can use it".

The default option is "Format disk", and I'm afraid one of these days I'll accidentally trigger it.

Is there any way to disable this message?

4
  • 9
    Note there are two great answers here: The answer by Snark is great if you only want to solve to problem for one host computer and/or have added the truecrypted partition as a Favorite on any computer. The answer by SylikC solves the problem even for computers who haven't seen your USB drive before, but it (kind of) breaks adding that USB drive to TrueCrypt Favorites. Aug 30, 2011 at 15:02
  • 3
    I'm having the same problem with W7 wanting to format a BTRFS partition on my Android whenever I plug it in to charge... Windows = data loss by design Aug 13, 2014 at 12:56
  • Your post grabbed my attention because I discovered something that I didn’t know about before... I understand now from your words that there are two types of encryption methods for whole drives? One large container or raw partition? What does VeraCrypt use?
    – Hosa
    Dec 23, 2020 at 17:18
  • Things like this push one closer to Linux and away from Windoze Oct 20, 2021 at 11:12

11 Answers 11

62

Try to go to the Control Panel - Administrative Tools - Computer Management. In the Disk Management part, remove the drive letter for the raw partition.

It should prevent Win7 from asking you to format the partition, while letting you mount the partition in TrueCrypt.

If it doesn't work, you could try this suggestion, which is to use Autokey to automatically dismiss the messagebox when it appears.

7
  • +1 that does work, i'm using the same trick for my 'truecryped' sticks
    – Molly7244
    Oct 1, 2009 at 12:42
  • 4
    I believe the OP is looking for a solution that will work on any computer. Software installation is not then an option.
    – harrymc
    Oct 1, 2009 at 13:10
  • 3
    A quicker way to open "Disk Management" is to Press Ctrl+R and type "diskmgmt.msc" :-) Aug 30, 2011 at 14:29
  • 2
    @msorens: no it won't; Windows identifies the USB hard drive through an ID written to its boot sector, so it will only ignore the partition from that specific hard drive. Jan 10, 2012 at 20:56
  • 1
    I used this "remove drive letter technique" to have 2 partitions (one un-encrypted and encrypted) on a removable drive by using VeraCrypt. Format the original partition as NTFS, use VeraCrypt to define a "container" encrypted file smaller than the total size of the partition. This creates another internally formatted partition that is useful under Windows. I make sure to simply remove the drive letter assigned to this new encrypted partition - to prevent windows from complaining about needing to format it. Just mount as a device partition the encrypted partition. Works well for me.
    – John C
    Jun 30, 2017 at 18:08
27

I have finally found a solution. I've tested this on Windows XP and Windows 7. With this solution device can't be accidentally formatted, when you plug it on another PC.

When you create a raw partition with TrueCrypt, it specifies it as partition type 0x06. This is a FAT partition, and Windows will always try to mount it.

Using a utility such as Beeblebrox (or your favorite RAW partition editor), change it to something else. I chose 0x64 which (based on the partition lists available) is a "PC-ARMOUR encrypted partition".

After changing it and then unplugging and replugging your device (power cycle), Windows will treat this partition as foreign and will not attempt to mount it. I will test it on Linux later, but I believe that'll prevent Linux from mounting it as well.

P.S. As Beeblebrox seems a bit outdated (last update of the Windows version in 2002) for newer Windows you can use internal diskpart. The commands for diskpart are:

list disk
select disk # <- your disk number here
list partition
select partition # <- your partition number here
set id=64
exit 

Credits are for @jonas-heidelberg and @mhenry1384.

12
  • 3
    Beeblebrox seems a bit outdated (last update of the Windows version in 2002) and I couldn't get it to run under Win7x64; under Linux you can change the partition type with fdisk (t option); in Windows 7 the build-in diskpart can do it with set id=64. Aug 30, 2011 at 14:19
  • 4
    Only ceveat is that afterwards TrueCrypt doesn't recognize the volume as a favorite any more (if it was one). You can add it again but you can't give it a label, with the result that it is only recognized when its name of the form \Device\Harddisk5\Partition3 does not change. I.e. adding a different USB stick to your system before plugging in the TrueCrypted one makes the Favorite not work :-( Aug 30, 2011 at 14:24
  • 1
    I have tried working around the caveat using different partition types, in particular 0x27 and 0xc7, but it seems that either you get the format warning (when Windows thinks it should be able to read the partition and considers it a volume), or you can't assign a Label in TrueCrypt (when Windows ignores the partition). Aug 30, 2011 at 14:27
  • 2
    The commands for diskpart are: list disk / select disk # / list partition / select partition # / set id=64 / exit
    – mhenry1384
    Oct 4, 2011 at 1:09
  • 2
    set id=64 doesn't work in Windows 10 (diskpart won't let you do it), but I seem have had luck with "set id=8DA63339-0007-60C0-C436-083AC8230908"
    – mhenry1384
    Apr 16, 2017 at 20:23
6

I want to re-confirm the answer that SylikC has given. You don't want to screw with your system, you want to indicate on the partition that it should not try mounting it. But there are 2 parts to this as I have found out.

First you do as SylikC says using diskpart set id=64 or choose from a wide range of partition types. But if you had previously assigned a drive letter to the partition, Windows 10 will still give you a "Format this Disk" dialog. To prevent that, you need to remove the drive letter assignment on the disk too.

To do that, before you set the partition type do

  list volume
  select volume <your volume with the drive letter>
  remove letter=<your drive letter you want to remove>
  set id=<now set the partition type>
  ...

If you had changed the partition type already, you have to first bring it back again to

  set id=6
  list volumes
  select volume <your volume with the drive letter>
  remove letter=<your drive letter you want to remove>
  set id=64

And that is it. Next time you pop in that USB drive, no more warning comes up. And I had no problems mounting a TrueCrypt drive.

2
  • At first, once you get past the nonsense you start with, it sounds as though you're just copying SylikC's answer. But you appear to have added some helpful and relevant information. If so, I'd recommend you edit out the nonsense and make it more clear that you have something to contribute, and then feel conflicted because you've now joined the sweaty, distasteful hordes earning "credits". Jul 28, 2017 at 17:44
  • this worked so well thanks! used it to stop the warning on the system partition for rockbox using a windows 10 system Jun 29, 2022 at 3:20
4

I use a program called USB Safely Remove, which knows about TrueCrypt and can be configured to automatically pop up the TrueCrypt password dialog when certain USB drives are inserted. It also allows you to unmount the TrueCrypt drive and safely remove the USB drive with a single click.

It's a commercial product (with a free trial), but they are currently giving away some free licenses, if you're quick. It's legit -- I got my license in their last giveaway.

4

On Windows 10 with USB stick that has UEFI boot and TrueCrypt/VeraCrypt partitions nothing works.

Windows 10 assigns letters in some way that neither DiskPart nor Disk Management sees them, but registry keys are present on HKLM\SYSTEM\MountedDevices, so the “Format” message appears... also on “safely remove hardware” it appears with letters on all partitions.

Windows 10 does it so badly that the EFI partition isn't in Disk Management with the letter, and in DiskPart it is also not seen as a volume and without letter, but if you go to Explorer (use “safely remove hardware” to learn the letter but do not remove it) you see it with a letter and can enter it, modify files/folders, etc.

That keys are re-created upon re-connect, so no possible solution.

This Windows 10 is a headache... all caused by treating external media with the Removable Media Bit as 'special', one-partition devices, even while they have multiple partitions.

Example: USB EFI Boot with NTFS+EFI+... on a USB stick that is impossible to re-set the removable media bit.

Warning: Changing the partition type can corrupt data on VeraCrypt partitions.

But there is a trick touching registry... take a lot of care when doing this and quadruple-check that the hex data is identical.

On the registry key, there are two entries with same exact hex data for each partition... well, one has the letter, one starts with \??\Volume{ ...

The trick is to rename the one that starts with \??\Volume{ that belongs to the partition you want to avoid getting a letter.

Instead of starting with \??\Volume{ make it start with #{.

And of course, delete the one starting with \DosDevices\.

Then, remove it (using the “safely remove” function) and plug it again. Press F5 to refresh the key in regedit to check if it worked.

On my tests it works, but must done be with a lot of care... I insist on quad checking hex data to be the same... a lot of times I didn't quad check it, I made a mistake, and sometimes on the next reboot Windows didn't start, so I needed to fix it with an ugly bootable Windows install DVD by going into console mode and running regedit from the DVD (no need to reinstall).

So, prior to deleting anything, save that registry hive, and quad check what you do.

But ensure the HEX DATA is what you want or else you can make your system unbootable. Quad check it!!!

ADDED:

  • If you take the care to not delete (only rename) the \??\Volume{ one, and also to not edit the hex data of it, you can be safe
  • In the worst-case scenario, you to need to boot with a Windows install DVD and go to console mode, run regedit, and rename it back to start with \??\Volume{

SO:

  • Always do one at a time...better to stay on the safe side

You have been warned, it is touching the registry by hand.

Why does this work?

  • It is telling Windows to ignore that 'volume', so it doesn't assign a letter or list it in the Safely Remove Hardware list for that device.

Yes, this works for USB memory cards, sticks, etc., without needing to touch the Removable Media Bit... it is just only to hide such partitions.

Side note: This is also valid for any other partition you do not want to auto-mount on USB connect.

1
  • This method works well and without modifying the partitions. I recommend opening the value editor, creating a screenshot of it and arrange it to compare more easily. It is scary and asking for a tool to manage it properly. MS would do good to add a "ignore partition" context menu entry toggling exactly this in the Disk Management utility, and a similar checkbox in format prompts.
    – korkman
    Jun 15, 2021 at 13:58
3

The simplest and safest solution would be to simply format the usb disk and recreate the TrueCrypt virtual encrypted disk as the only file on the disk.

For completeness only : I note the need to first save all existing data within the TrueCrypt disk.

2

I tried this: My portable HDD was NTFS-formatted and blank.

  • Encrypted it mounted
  • Added data
  • Unmounted it, re-connected and had this Windows message "you need to format…"
  • I unassigned the drive letter in disk management to the encrypted USB drive

That did the trick – no more pesky messages for me. I connect the drive and invoke TrueCrypt, select the portable HDD, click mount and provide the password. Voilà: The volume is mounted.

2

I managed to achieve it by creating the drive as a GPT and then using diskpart to modify the partition GPT ATTRIBUTES...

list disk
select disk # <- your disk number here
list partition
select partition # <- your partition number here
GPT ATTRIBUTES=0xC000000000000001
exit

0x0000000000000001 marks the partition as required.
0x8000000000000000 Prevents the partition from having a drive letter automatically assigned.
0x4000000000000000 Defines the partition's volume as hidden.

3
  • 1
    Why is this downvoted? Jan 3, 2020 at 18:14
  • Is this Windows only, or will most Linux distros also recognize the second or third option and not try to mount that partition?
    – mmortal03
    Jul 7 at 5:02
  • I found more information on these settings here: superuser.com/questions/1393376/…
    – mmortal03
    Jul 7 at 5:08
1

I used gparted on linux to change the partition table to GPT and set the flag 'hidden', then did 'fdisk -t' to set the guid as microsoft reserved (10), no more 'format disk' messages on windows. Even on first time plug. The truecrypt volume mounts just fine on both windows and linux. If that is not enough for you, you can use diskpart on windows and use 'GPT ATTRIBUTES=0x4000000000000000', that should most definitely work.

DISKPART> detail partition

Partition 1
Type    : e3c9e316-0b5c-4db8-817d-f92df00215ae
Hidden  : Yes
Required: Yes
Attrib  : 0X0000000000000001
Offset in Bytes: 1048576

There is no volume associated with this partition.
4
  • Welcome to SuperUser! Your post doesn't appear to address the question in a useful manner, since the OP specifies Windows and your answer is about Linux. Also, this is a VERY old post with various answers, one of which is accepted. You will find that you will have a better experience if you take moment to take the Stack Overflow tour. If you follow the norms of the Stack Overflow community and approach it with an attitude of helping others too, it will serve you well.
    – Rey Juna
    Jan 18, 2019 at 19:40
  • 1
    @Rey Juna, the answer also said that OP could use "DISKPART on windows" and set GPT ATTRIBUTES. By the way, StackExchange doesn't exist only for solving the OP question. KopetePanda provided a possibly useful answer, too. I came here because I am not a regular Windows user (most of time I use Linux) and I faced a windows system with this annoying error, Windows 7 opens dozens of popups, offering to format the disk - even if the disk was formatted in Windows itself! I'll try KopetePanda's linux solution, since all the Windows solutions proposed (even the accepted answer) didn't work for me.
    – mguima
    Mar 17, 2019 at 22:03
  • @mguima I'm glad this answer worked for you. However, I think that another question/answer specific to Linux would be easier to find for anyone in your situation rather than burying it in a post that has a different configuration.
    – Rey Juna
    Mar 18, 2019 at 15:20
  • @Rey Juna, Of course the same answer in a question especific to linux would be easier to find. But this question didn't existed. And, after searching for a while in a lot of places, I was able to find it.
    – mguima
    Apr 27, 2019 at 21:13
0

I found this solution which I will paraphrase here. This works for all disks and versions of Windows but requires formatting the disk from an Ubuntu Live DVD/USB or an Ubuntu system. As an added benefit, you can add a useful label to the disk which will show up on the side under "My PC" in Windows.

  1. Load Ubuntu and install VeraCrypt if it isn't already installed
  2. Open the Disks utility and create an empty partition table
  3. Create a single partition with the filesystem type "other".
  4. When again prompted for the filesystem type, select "no filesystem".
  5. Format the partition not the disk in VeraCrypt as usual, selecting the NTFS file system when prompted
  6. Mount the partition in veracrypt, selecting "do not mount" in the filesystem options prior to mounting
  7. Head over to the Disks utility again, find the /dev/mapper/veracrypt encrypted volume, select the NTFS filesystem, click on the gear icon, select "edit filesystem" and assign it your desired name
  8. Dismount your volume in VeraCrypt
0

You can change the partition type to 0x17(Hidden NTFS) and Windows will no longer remind you that you need to format the partition.

Disk program on Gnome

2

You must log in to answer this question.

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