How to truly "hide" a GPT partition?

Discussion in 'Scripting' started by Atari800XL, Sep 12, 2021.

  1. Atari800XL

    Atari800XL MDL Addicted

    Apr 3, 2011
    927
    1,623
    30
    On an MBR disk, you can set a partition as hidden, this is useful for multiboot scenarios etc. For example, with Grub4Dos, prior to booting an OS:

    Code:
    hide (hd0,0)
    hide (hd0,1)
    unhide (hd0,2)
    root (hd0,2)
    makeactive (hd0,2)
    chainloader /bootmgr
    boot
    
    I want to do something similar on a GPT disk, but didn't have any success yet. Any ideas? Im already experimenting with modifying the partition table directly, using some cool new Grub4UEFI scripts by a guy called "Wonko", but I was just wondering if any of you guys have any further info.

    For now, I'm using a workable alternative, but this is merely preventing the partitions from getting a drive letter, so it's not a true "hiding" of the partition.
    This alternative works bij setting a special attribute of the partition with Diskpart:

    Code:
    select disk 0
    select partition 1
    gpt attributes=0x8000000000000000
    
     
  2. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    12,944
    62,764
    340
    Wonko is truly sane :D

    i believe reboot.pro guys really knows better
     
  3. Atari800XL

    Atari800XL MDL Addicted

    Apr 3, 2011
    927
    1,623
    30
    Thanks, of course you were in the top three of people I wanted to double check this with :)

    So we should already give up hope for an MDL solution to this?
     
  4. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    7,296
    11,420
    240
    The default way to hide a partition is to simply not assign it a drive letter.
    To go beyond that you can assign it an id type of something like a recovery partition.
    Beware that doing this is not advised as these set commands can also set file system types and other things.
    Anyway a command like:
    Code:
    set id=17
    in diskpart on the appropriate partition should set an MBR partition to a recovery version and thus be extra "hidden".
    This is just info I'm relaying from internet searches. You should test it on a vm drive. IIRC the GPT partitions require those long codes like the one you listed above.
     
  5. Atari800XL

    Atari800XL MDL Addicted

    Apr 3, 2011
    927
    1,623
    30
    Thanks. I'm testing on a spare laptop now, so "anything goes".
    I've screwed up things beyond repair multiple times now, so nothing scares me :)
    Luckily I've automated the partitioning from scratch etc. (including setting that "0x800..." attribute), so each new test has a fully "clean" starting point.

    Maybe I should do a full write up here of what my experiment is all about, including the Grub4UEFI multiboot stuff...
     
  6. Tito

    Tito Super Mod / Adviser
    Staff Member

    Nov 30, 2009
    18,002
    17,037
    340
    @Atari800XL

    https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/gpt

     
  7. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,781
    797
    60