2

In a comment, Johan wrote:

In the rare combination GPT disk + legacy BIOS boot, the boot code is read in the old-fasioned way from the MBR

What is the proper way to determine if a PC has the above-described rare combination? What Windows and/or Linux commands should be used to examine the disk for such a condition?

  • I would consider it a bonus for a U&L audience to know the Windows commands for a particular situation, just to set expectations. – Jeff Schaller Jun 5 at 19:17
1

If you have a working Linux installation on the PC, you can check if the directory /sys/firmware/efi exists. If it does exist, then your computer has EFI firmware and is not in BIOS compatibility mode. If the directory is missing, then the machine boots using the legacy BIOS.

The partitioning scheme can be checked using fdisk. If fdisk p command ("print the partition table") reports "msdos" for the disklabel type, then the disk has an old-fashioned MBR partition table. If the disklabel type is "gpt", the you have s GPT disk.

  • I have a bootable USB pen drive with Linux and Clonezilla. The pc in question has a recently installed, updated, configured, and properly operating Win7 Home Premium 64bit SP1. The history of the disk is unknown (purchased used, to replace original failed disk). – Royce Jun 5 at 22:28
  • gdisk says "MBR only" and "GPT present" – Royce Jun 5 at 22:33
  • I want to make a Clonezilla image backup of the disk. But Clonezilla does not like the disk the way it is. It says "This disk contains mismatched GPT and MBR partition /dev/sda. It will confuse Clonezilla and might make the saved image useless. You can use gdisk or sgdisk to fix this issue. If you are sure only MBR partition table is the one you want, you can run this command to destroy the GPT partition table while keeping the MBR partition table: sudo sgdisk -z /dev/sda" – Royce Jun 5 at 22:40
  • @Royce it sounds like you have a system with an issue. Please ask a question about that, it sounds like we've had an "XY problem" – derobert Jun 6 at 0:53
  • My guess is that the disk was originally partitioned using a GPT partition table, then repartitioned to MBR, without wiping the GPT header and GPT partition table that immediately follow the Master Boot Record. If my assumption is correct, the MBR partition table is the one that reflects the partitions on this disk, and the GPT partition table (or what is left of it) is a ghost of the past. Without seing the disk, I'm not sure what you can safely do. The warnings regarding sgdisk's -z option should be taken seriously. The old GPT partition table may have been partially overwritten. – Johan Myréen Jun 6 at 6:25
1

I don't know if it's a rare condition, it's one of the sane ways to use larger disks on older machines. Or when the system firmware is buggy and, e.g., wont properly fall back to a second disk when booting a software RAID setup.

First, you'd check that the machine is not booted with EFI. See “How to know if I'm booting using UEFI?” to check.

On Linux:

Under Linux, you should see a few indicators if you run gdisk -l /dev/DISK

  1. Partition table is GPT ("Found valid GPT with protective MBR; using GPT.")
  2. There is a BIOS boot partition (listed as code EF02). This is where most of GRUB lives (it replaces the sectors that in a traditional MBR are between the boot sector and the first partition).

Example, from one of my disks:

# gdisk -l /dev/sdd
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdd: 5860533168 sectors, 2.7 TiB
Model: ST3000VN000-1HJ1
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 3F3F7901-A38A-42FF-A7BA-8FBD1C35FB11
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 5860533134
Partitions will be aligned on 8-sector boundaries
Total free space is 5582 sectors (2.7 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          259024   125.5 MiB   8300  Linux filesystem
   2          260096          517135   125.5 MiB   0700  Microsoft basic data
   3          518144      1953524128   931.3 GiB   8300  Linux filesystem
   4      1953525760      3907033263   931.5 GiB   8300  Linux filesystem
   5      3907035136      5860533134   931.5 GiB   8300  Linux filesystem
 128              34            2047   1007.0 KiB  EF02  BIOS boot partition

On Windows:

Note this a different disk I quickly set up for a VM.

diskpart's list disk command shows a * in the GPT column if a disk is using GPT:

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online           40 GB      0 B
  Disk 1    Online           20 GB      0 B        *

Unfortunately, list partition (after selecting the disk using select disk 1) shows the two partitions as "unknown":

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Unknown           4096 KB    17 KB
  Partition 2    Unknown             19 GB  5120 KB

but if you detail them (after select partition 1), you get the type GUID:

DISKPART> detail partition

Partition 1
Type    : 21686148-6449-6e6f-744e-656564454649
Hidden  : Yes
Required: No
Attrib  : 0000000000000000
Offset in Bytes: 17408

and 21686148-6449-6e6f-744e-656564454649 means BIOS boot partition. (0fc63daf-8483-4772-8e79-3d69d8477de4, by the way, is a generic Linux partition).

Alternatively, in Disk Management, select the disk, pick Properties, and check the Volumes tab. That will tell you if the "partition style" is MBR or GPT. Unfortunately there does not appear to be a way to get the partition types from Disk Management.

  • diskpart > list disk > select disk 0 > list partition > select partition 1 > detail partition yields the following: Type: 07, Hidden: No, Active: Yes, Volume ###: Volume1, Label: System Reset, Fs: NTFS, Type: Partition, Status: Healthy, Info: System – Royce Jun 5 at 23:06
  • disk management > properties > Volumes says "Partition Style MBR" – Royce Jun 5 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.