Ubuntu – Is it safe to format msftres, msftdata and hidden partitions

gpthard driveinstallationpartitioningssd

I have an acer V7 which came with a 1TB HDD, 24GB SSD and Windows 8 installed. I have installed Ubuntu onto the SSD and formatted the main partitions of the HDD. However, I also notice 3 other partitions on the HDD marked msftres, msftdata. Is it safe to format these also so that I have one contiguous drive partition or will I be wiping something important like boot or bios data?

Best Answer

The "flags" shown in parted or GParted can refer to different things. Some of the common ones on GPT disks include:

  • msftres -- This flag means "Microsoft reserved." It's used as "scratch space" by certain Microsoft tools, so it should not be deleted or re-purposed unless you're deleting Windows. See the Wikipedia entry on this partition type for more information.
  • msftdata -- This flag identifies a Microsoft Basic Data partition. It normally holds a Microsoft filesystem, like FAT or NTFS, so such partitions will include your C: partition and perhaps recovery or data partitions. You should not delete or change them unless you understand precisely what type of data is on the partition and want to delete it. Note that Linux used to use the same type code for its own partitions, so you might see this flag on a Linux partition, too. Two years ago a new Linux-specific type code was created, and Linux partitions with that type code will show up as having no flag set. Versions of libparted that recognize the new Linux-specific type code are only just becoming available. The "msftdata flag" appeared with that same new version of libparted.
  • boot -- On a GPT disk, this flag identifies an EFI System Partition (ESP). You should definitely not mess with this partition unless you know what you're doing. Likewise, you should not set the "boot flag" on any other partition -- not even on a Linux /boot partition. Note that the "boot flag" has an entirely different meaning on MBR disks. On such disks, it's common to set the "boot flag" on a Linux /boot or / partition, although it's not usually required to do so.
  • bios_grub -- This flag identifies a BIOS Boot Partition, which BIOS-mode GRUB uses to store boot code. You don't normally need such a partition on an EFI-booting computer. If you've switched from a BIOS-mode to an EFI-mode installation, you can safely delete this partition, but because a BIOS Boot Partition is normally quite small (~1MiB), you won't recover much space.
  • legacy_boot -- Unlike all the flags I've just described, this one does not correspond to a type code; instead, it identifies a GPT attribute. This attribute is used by the GPT-aware version of SYSLINUX to identify a bootable partition. That is, its purpose is similar to that of the "boot flag" on an MBR disk. To most tools, this flag is irrelevant; it can be set or deleted as you see fit.
  • hidden -- Like "legacy_boot," this flag is a GPT attribute, not a partition type code. It identifies partitions that the EFI should ignore. In my experience, though, most EFIs ignore this flag, so it's not really very useful. Some computers ship with this flag set on some partitions, though.

You can read about more about these, and other GPT type codes, in the Wikipedia entry on GPT. Note that the "flag" names assigned by parted and GParted are specific to libparted. Other tools, like GPT fdisk or the Windows partitioning tools, have other ways to refer to GPT type codes. (Few programs use the codes directly, since they're long and awkward hexadecimal numbers.)

Note also that libparted uses the same "flag" concept to identify two entirely different data structures: partition type codes and partition attributes. Type codes are mutually exclusive; a partition can be an ESP or a Microsoft Basic Data partition, but not both. Thus, if you remove the "boot flag" on an ESP, it will likely pop up with an "msftdata flag," since ESPs use FAT, and FAT partitions get the "msftdata flag" by default. (In older versions of libparted, the "msftdata flag" doesn't exist, so the partition would have no flag.) A partition can have multiple attributes, though, so it could have both the "hidden flag" and the "legacy_boot" flag set. It could also have a type-code flag set, like those two plus "bios_grub". This dual use of the "flag" concept is confusing. GPT fdisk (gdisk and related programs) separates these concepts, using two-byte hexadecimal codes (like EF00 or 8300) for type codes and reporting attributes as such.