I have owned a Microsoft Surface for the past years and I needed, for some small amount of time, a linux distribution installed on it, so I thought the best way to do it would be a semi-live distribution where all the permanent storage would go on a partition on the SD card and, while it works, when on windows a spurious drive letter and a “Do you want to format this partition” dialog appears every time. Hiding this partition for windows should be easy, right?
Oh boy I was wrong. Setting the “hidden” flag on GPT using Microsoft
was useless, as useless as it was using the
gdisk tool. Somehow, windows
will ignore any of the known GPT flags on any volume. It ignores the “Read only”
flag, as it will format the partition if you let it. It ignores the “OEM
partition” flag, ignores the “No drive letter flag” as well…
Finally the solution came from an unexpected place, Microsoft TechNet, a forum well known for providing canned non-answers by people with substantial reading issues but an user, one Norman Diamond, blasted through the canned non-answers and found a solution. Lies.
I am copy and pasting the solution verbatim, since I have little faith TechNet will continue to exist in the near future. Emphasis mine, spellcheck might have also fixed some mistakes.
SOLVED, for the moment.
I have to set my Linux partitions to type code
EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, Microsoft basic data partition.
Linux does not care. When I tell Linux to mount the partitions, Linux sees the ISO9660 file system in one partition and the ext4 file system in the other partition. I haven’t fully tested them yet but I think Linux handles them properly.
Windows finally obeys. Windows sees them as Microsoft basic data partitions, but Windows sees the attribute bits 0xC000000000000001 and finally Windows obeys the bits. Windows doesn’t assign drive letters and Windows doesn’t try to trick the user into formatting and losing the contents.
Now that this solution is known, I wonder how long Microsoft will take to break it.
And an example of TechNet people having severe reading difficulties.
Windows finally obeys
OK then it was not a windows issue but Linux issue because you have to set Linux partitions to type code
[Redacted TechNet expert username out of second hand shame]
This time you know you’re lying. Several GPT partition types are defined for Linux, and when Linux uses them properly, Windows attacks them. When I have to use Linux tools to tell lies, to use a partition type that is defined for Windows, to defend Linux filesystems from attacks by Windows, it is a Windows issue. Even though a way can be found for Linux to defend against Windows’s malice, the issue is a Windows issue.