Ubuntu – Is it safe to remove “diag” flagged partitions

dual-bootgptpartitioningsystem-installationuefi

I have a samsung laptop which came with windows 8 on a 1TB HDD.

I am preparing my disk with gparted. I expected to see 2 or 3 partitions but there are actually 7! Now I've brushed up on UEFI and gpt and I think I understand what these partitions are.

parted -l yields (I added the labels by hand):

Model: ATA ST1000LM024 HN-M (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End     Size    File system  Name                          Flags                Label
 1      1049kB  524MB   523MB   ntfs         Basic data partition          hidden, diag        Windows RE tools
 2      524MB   839MB   315MB   fat32        EFI system partition          boot                 SYSTEM
 3      839MB   973MB   134MB                Microsoft reserved partition  msftres                      
 4      973MB   973GB   972GB   ntfs         Basic data partition          msftdata
 5      973GB   973GB   471MB   ntfs                                       hidden, diag
 6      973GB   999GB   25.8GB  ntfs         Basic data partition          hidden, diag         SAMSUNG_REC2
 7      999GB   1000GB  1074MB  fat32        Basic data partition          hidden, diag         SAMSUNG_REC

I want to keep a usable windows and to keep enough to restore it if need be.
My plan is to keep sda1 which apparently is needed for recovery.
I obviously keep sda2 since I want my system to boot (although 300MB is a little overkill I'll keep the Microsoft reserved partition since it is small and (apparently?) needed. I will partition sda4 to make room for linux.

My questions are about sda5, 6 and 7

What is the purpose of sda5? It is flagged "diag" but it is unlabelled. Do I need to keep it if I want to restore windows to the factory state at some point?

sda6 (SAMSUNG_REC2) is the recovery partition created (I guess) by a samsung tool which I must have uninstalled as soon as I got the computer. My understanding is that the Windows RE tool (on sda1) will be able to restore Windows from this recovery partition, am I right?

sda7 (SAMSUNG_REC) is a 1GB FAT32 partition. I don't know if it is important or not since I already have SAMSUNG_REC2…

Can I safely delete sda5 and sda7? Am I right in keeping the 5 other ones?

Best Answer

First, the "diag flag" is (sort of) explained in the parted documentation:

‘DIAG’

    (MS-DOS) - Enable this to indicate that a partition can be used as
 a diagnostics / recovery partition.

I've not seen any evidence that this flag is actually used, but my knowledge of the Windows world is limited. Thus, I wouldn't mess with the flag itself. I also wouldn't use it as an indicator of whether a partition is necessary.

Second, /dev/sda5 and /dev/sda7 are both pretty small -- 471MB and 1074MB, respectively. Your disk is 1000GB, so they consume a total of 0.1545% of your disk's capacity. Given that GPT can take up to 128 partitions by default (and that value can be raised, if necessary), these partitions aren't using up enough space or partition slots to be a concern -- certainly not compared to the risks involved in deleting a partition whose purpose you don't fully understand.

Third and OTOH, a lot of computers today ship with enormous amounts of bloatware, and there's been at least one recent pre-installed malware scare (Superfish). Windows 8 is also rather un-loved compared to its predecessor, Windows 7. Thus, many people prefer to wipe the pre-installed Windows and re-install using a Microsoft-provided image. This will result in a cleaner install, without any manufacturer-provided add-ons. A Web search will turn up plenty of sites describing how to get legal copies of Windows for installation; this is the first page to turn up in my search, but you can find others easily enough. Note that if you plan to install anything but the version that shipped with your computer, you may need to buy it, rather than rely on a free image from Microsoft. It's best to ask on a Windows forum if you need more help with this. The point of this paragraph, though, is that a re-install from a Microsoft image is likely to have a simpler partition layout than what you've got now, since some of those "extra" partitions probably exist to service the manufacturer-specific tools.

Related Question