3

I need to examine the MBR part of a hybrid MBR/GPT USB Stick.
My version of fdisk (fdisk from util-linux 2.29) lists the GPT partition table, which older versions of fdisk does not.

Tried solutions:
I can't find any switch to force it to read the MBR table in the manpage and -c=dos to enable dos compatibility mode doesn't change anything. Copying the first 512 bytes into a file and using fdisk on that works to show the MBR partition table but is not very comfortable.

How do I get the MBR partition table?

Outputs:

$ sudo dd if=/dev/sdb of=first512.img bs=512 count=1
1+0 records in
1+0 records out
512 bytes copied, 0,0010523 s, 487 kB/s

$ fdisk -l ./first512.img
Disk ./first512.img: 512 B, 512 bytes, 1 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x55e7aea2

Device          Boot  Start      End  Sectors  Size Id Type
./first512.img1 *     22528   153599   131072   64M  7 HPFS/NTFS/exFAT
./first512.img2           1    22527    22527   11M ee GPT
./first512.img4      153600 15417343 15263744  7,3G ee GPT

Partition table entries are not in disk order.

$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 7,4 GiB, 7893680128 bytes, 15417344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 510488E2-D768-4675-A53D-16E041F51641

Device      Start      End  Sectors  Size Type
/dev/sdb1    2048    22527    20480   10M EFI System
/dev/sdb2   22528   153599   131072   64M Microsoft basic data
/dev/sdb3  153600   163839    10240    5M BIOS boot
/dev/sdb4  163840 15417278 15253439  7,3G Linux filesystem
wullxz
  • 2,716
  • 4
  • 26
  • 38

1 Answers1

2

fdisk -t dos -l /dev/sdx does the trick.

wullxz
  • 2,716
  • 4
  • 26
  • 38
  • Nope, it only gives you data like: ```Disk /dev/nvme1n1p5: 685.52 GiB, 736069943296 bytes, 1437636608 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes ``` – user1660210 May 12 '22 at 08:47
  • @user1660210 then you're not using a **hybrid MBR/GPT** partition table. This only works if both types of partition tables are actually present. – wullxz May 23 '22 at 15:36