Thursday, April 30, 2015

linux - HDD appears to have both MBR and GPT


I have an external HDD which appear to have both MBR and GPT. The result is that Windows reads different partitions than Ubuntu and OS X. The GPT seems correct to me (I can access and use the disk fine in Ubuntu and OS X), while the MBR has an old partition table. Is there a way to remove the MBR/fix this issue without wiping the drive?


Output from fdisk -l:


Disk /dev/sdb: 3,7 TiB, 4000787029504 bytes, 7814037167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: 6D14A59C-0E35-4D79-AFC2-DEC63ACAA2E2
Device Start End Sectors Size Type
/dev/sdb1 2048 6176047103 6176045056 2,9T Microsoft basic data
/dev/sdb3 6176047104 7813774983 1637727880 781G Apple HFS/HFS+

From OS X diskutil list


/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *4.0 TB disk2
1: Microsoft Basic Data maxntfs 3.2 TB disk2s1
2: Apple_HFS TMm 838.5 GB disk2s3



Screenshots from Windows 10 disk management (as links, too low rep for images):


screen1
screen2


Answer



gdisk (“GPT fdisk”) has a one-step(-ish) option to create a protective MBR.


$ gdisk /dev/sdb
x
n
w

This will:



  1. Launch gdisk

  2. Enter expert mode

  3. “create a new protective MBR”

  4. write table to disk and exit”


It may even detect the problem and offer to fix it right away. You currently have a so-called Hybrid MBR, though it’s out of sync.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...