More answer than you probably wanted, but....
There are several ways. The details vary with the tool...
GPT fdisk (gdisk) provides the most complete diagnostic of partition table type that I'm aware of. Type "gdisk -l /dev/sda" (or whatever the disk is), and you'll get something like this, among other things:
Code:
Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present
This tells you what partitioning data the tool has detected. In this case, it's an MBR disk. A GPT disk would look like this:
Code:
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
There's another common possibility that gdisk can detect: a hybrid MBR, in which a GPT disk has had MBR "copies" of up to three partitions added. This shows up in the gdisk scan as:
Code:
Partition table scan:
MBR: hybrid
BSD: not present
APM: not present
GPT: present
There are various broken configurations, too, like "MBR: MBR only" with "GPT: present", which generally means that somebody took a GPT disk and repartitioned it with fdisk or some other GPT-unaware utility. This is technically legal (it's no longer a GPT disk, but an MBR disk), but it confuses libparted-based tools such as GParted. The BSD and APM lines change if gdisk detects a BSD disklabel (usable by FreeBSD, NetBSD, etc.) or an Apple Partition Map (APM; used by 680x0- and PowerPC-based Macs).
The text-based GNU Parted reports MBR/GPT status, but not hybrid MBRs, on a line like this:
Code:
Partition Table: gpt
It uses "msdos" to mean "MBR" on this line. It reports hybrid disks as being GPT, and if you make changes it writes a fresh protective MBR, wiping out the hybrid partitions. It tends to flake out with most damaged or confused disk types, but it at least reports an error message. It can also detect and work on several other partition table types.
GParted behaves a lot like GNU Parted, but you've got to select View -> Device Information to see the partition table type.
With fdisk, you can identify GPT disks in a couple of ways. First, fdisk displays the following warning:
Code:
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk
doesn't support GPT. Use GNU Parted.
Second, GPT disks have a type-0xEE MBR partition, known as the "protective partition:"
Code:
Device Boot Start End Blocks Id System
/dev/sdc1 1 3981311 1990655+ ee GPT
This partition must be present on all GPT disks, but a true GPT disk contains additional data structures; so you could put such a partition on a blank disk using fdisk and it would look superficially like a GPT disk to fdisk, but it wouldn't really be a GPT disk. (The warning displayed earlier seems to check for other GPT signatures, but I've not checked the source code to learn the details.)
Bookmarks