How do I disable "you need to format this disk" message in Windows Vista/7?

74

38

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?

Joe Attardi

Posted 2009-10-01T03:44:31.887

Reputation: 843

1I'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 – Mark K Cowan – 2014-08-13T12:56:05.000

8Note 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. – Jonas Heidelberg – 2011-08-30T15:02:41.433

Answers

57

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.

Snark

Posted 2009-10-01T03:44:31.887

Reputation: 30 147

1I 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 – 2017-06-30T18:08:47.753

@JonasHeidelberg you can just use WinKey+R and type diskmgmt.msc in there. – ypocat – 2018-04-08T04:57:40.610

2A quicker way to open "Disk Management" is to Press Ctrl+R and type "diskmgmt.msc" :-) – Jonas Heidelberg – 2011-08-30T14:29:01.860

A question for @JonasHeidelberg or Snark: I like this approach, but doesn't that mean the system will no longer check any USB thumb drive that gets the same letter assigned? – Michael Sorens – 2012-01-10T00:21:42.537

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. – Jonas Heidelberg – 2012-01-10T20:56:26.033

+1 that does work, i'm using the same trick for my 'truecryped' sticks – None – 2009-10-01T12:42:14.010

4I believe the OP is looking for a solution that will work on any computer. Software installation is not then an option. – harrymc – 2009-10-01T13:10:47.733

26

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.

SylikC

Posted 2009-10-01T03:44:31.887

Reputation: 261

2set 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 – 2017-04-16T20:23:17.210

as @mhenry said, that is a selution, and is required if you use GPT. – BananaAcid – 2017-05-06T11:59:26.690

... His used GUID is for "Linux Reserved" = 0x83. – BananaAcid – 2017-05-06T12:12:11.143

set id=64 worked fine on Windows 10 (autumn 2018, but the VC partition was 1 of 2 partitions on an extended disk, the other partition is not encrypted). The type seems to be inherited from whatever was there before (did an in-place encryption of NTFS and the original type was 7, not 6). – vladr – 2018-09-30T17:01:26.430

After set id=64, I get "The specified type is not in the correct format." on Windows 7. If I recall correctly, set id=aaaaaaaa-0000-aaaa-aaaa-aaaaaaaaaaaa worked, but I don't recall where that ID came from. – root – 2019-11-16T12:27:49.210

By the way, the default ID (causing normal behavior such as the “you need to format this disk” message) is EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, see https://en.wikipedia.org/wiki/Microsoft_basic_data_partition

– root – 2019-11-24T13:49:56.570

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.

– Jonas Heidelberg – 2011-08-30T14:19:28.963

This solution will solve the problem for that disk no matter what computer you connect it to, which is great :-). – Jonas Heidelberg – 2011-08-30T14:23:06.397

4Only 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 :-( – Jonas Heidelberg – 2011-08-30T14:24:35.660

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).

– Jonas Heidelberg – 2011-08-30T14:27:31.193

2The commands for diskpart are: list disk / select disk # / list partition / select partition # / set id=64 / exit – mhenry1384 – 2011-10-04T01:09:38.067

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.

Jason Brown

Posted 2009-10-01T03:44:31.887

Reputation: 101

3

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.

Gunther

Posted 2009-10-01T03:44:31.887

Reputation: 31

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". – music2myear – 2017-07-28T17:44:46.263

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.

harrymc

Posted 2009-10-01T03:44:31.887

Reputation: 306 093

2

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.

Laura

Posted 2009-10-01T03:44:31.887

Reputation: 29

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.

voila1290

Posted 2009-10-01T03:44:31.887

Reputation: 21

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.

KopetePanda

Posted 2009-10-01T03:44:31.887

Reputation: 11

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 – 2019-01-18T19:40:08.730

@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 – 2019-03-17T22:03:45.603

@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 – 2019-03-18T15:20:38.413

@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 – 2019-04-27T21:13:23.377

-1

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.

Gosnik

Posted 2009-10-01T03:44:31.887

Reputation: 1

Why is this downvoted? – Atte Juvonen – 2020-01-03T18:14:08.170