Hiding Drives in Windows 8.1

Hiding Drives in Windows 8.1

The problem:
When installing Windows on a machine used in a dual boot situation, where the other operating system(s) are based on Linux, the Linux drives are assigned drive letters in Windows and are offered for use. Windows does not recognize the ext4 file system and will offer to format them any time they are accessed. The possibility of damaging the file system of the Linux drives seems to be far too easy to do. The drive letters should be hidden in Windows.

The easy way:
One easy way to hide the drives in Windows, is to use Computer Management process to remove the driver for that drive. You can remove the driver for all the drives used by Linux without damaging the data held there. Windows won’t let you remove the drive that has the Windows installation, so this process is safe to do, and works… Almost. The removal of the drives will not survive a boot. I could find no commands that would do this process from a CLI so the possibility of a quick and dirty batch file was out.

The right way:

NOTICE: If you are not comfortable using the registry editor and/or you do not understand the concept of using binary flags, you should probably not attempt this process. A wrong move could damage your Windows installation.

A new key should be added to the registry which tells Windows to ignore one or more drives on the system. The key added is in:
Hkey_Current_User->Software->Microsoft->Windows->Current_Version->Policies->Explorer
and the key is named NoDrives, of a type Reg_Dword and holds a numeric value entered in decimal format.

The value of this key is used as a binary mask where a 0 signifies the the drive letter represented by that position will be visable, and a 1 signifies that the drive letter for that position will be hidden. Windows uses A, B and C with D and possibly E used for DVD drives. So the number used to hide Linux drives will start at 16 or 32. Assuming we have drives C through L, a value of 32 will hide drive F. A value of 64 will hide drive G. A value of 96 will hide both F and G. A value of 4064 will hide drives F through L.

Final thoughts:
It is worth noting that a change to the hardware of the machine could very well require recalculation and editing of that registry key. For instance, if you removed the drive that had been shown as drive L and didn’t change the registry key, you would not be able to see a USB drive added to the system as it would be hidden. I can well imagine the time lost and anguish suffered by forgetting this little number and I wonder how long it would take someone to figure it out.

Bart

Interesting, thanks

Do you have a view on the filesystem drivers for mounting Linux filesystems R and RW in windows? Presumably that would be a second, but different way to handle issues.

I don’t. That might be an even better way as, although in my case I don’t want to even see the Linux drives in Windows, if would eliminate the possibility of the problems I mentioned when changing hardware.

Bart

Interesting.

When I boot Win 8.1 (probably tomorrow morning), I’ll check to see what Windows says about those partitions.

In my case, I have them flagged as linux partitions (shown with partition type code 8300 in “gdisk”). I think “parted” gives them the same type code as Windows partitions, which might be part of the problem.

Indeed. In fact, that is exactly what the problem is. Windows and Linux share a partition type code.

I may be wrong here. My understanding is that the type code is a fiction. What is really used is a UUID. There’s some sort of approved list of UUIDs with particular meanings. When “parted” was written, there was no entry for linux file systems in that list. But an entry made it in time for “gdisk”. Presumably a future version of “parted” will stop using a Windows code for linux partitions.

Sounded interesting, so looked for the documentation.
If you’re running XP (you shouldn’t), the process will describe an arcpath rather than a letter.

For every OS after XP (as of today), the process merely hides the drive letter from typical Windows apps (like Explorer). As long as the drive letter doesn’t change, the configuration will remain effective. Although drive letters are “sticky” through drive removal and insertion because of the initial identifier written to all drives mounted by Windows, it’s not 100% reliable if you change and move drives.

You are not removing any drivers, merely hiding where the drive letters may appear.
No modifications or other actions are done at the partitioning level (physical disk).
The hidden drives are still mounted and accessible by other means, including CMD.

IMPORTANT IMPROVEMENT -
If you are running Windows 8 Pro, there is no need for Registry modifications. You can hide drives using the MyComputer local policy. You can launch gpedit.msc directly or mmc and add the snap-in. Note though that Win8 Home does not include or support this method.
(Possibly not true only for Win8 Pro? There is a video on how to add GPO to Win8 Home
www.youtube.com/watch?v=oqk3vtTYfzY )

The TN reference which includes popular DWORD values
https://technet.microsoft.com/en-us/library/cc938267.aspx

If your drive letters are many and potentially complex, this is an online tool to calculate the DWORD value
http://ss64.com/nt/syntax-nodrives.html

HTH,
TSU

I checked. None of my linux partitions is assigned a drive letter. When I look at them in disk management, they are all shown as “healthy”. I interpret this as indicating that Windows knows to keep its hands off.

As noted above, I used “gdisk” to set the type code to 8300 for normal linux partitions and 8E00 for an LVM partition.