Is it safe to remove "diag" flagged partitions?

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.


If you look at it on Windows, in the Disk Management stuff accessible by right-clicking on 'This Computer', you will immediately find out that those partitions are used for recovery, at least according to Windows.

Personally I don't think doing so is a good idea. If you are really willing to try, mount and see what's in them first. Then you can consider deleting them, which almost certainly makes the recovery from Windows 8 EFI unavilable, or resizing them with gparted so you can gain a little more space.