Fixing the problem where gparted (parted) won’t see a partition due to a mac partition table

I purchased an external HD that was “mac compatable” but I used it with a linux system and used fdisk to put two partitions on it.

Later on, I wanted to use gparted to easily resize one of the partitions, but it refused to see any partitions at all on the disk.

fdisk could still see them just fine, but reported “Partition type: mac”

It turns out that the problem was that the disk originally came with a mac partition table in addition to (right after) the regular MBR Master Boot Record.

I noticed that the first partition didn’t actually start until 63 sectors into the disk (at the beginning of the 2nd cylinder).

Device Boot Start End Blocks Id System
/dev/sdb1 63 1171893554 585946746 83 Linux

So I used DD to copy the first cylinder to a file:

sudo dd bs=512 count=62 if=/dev/sdb of=firstCyl.bin
62+0 records in
62+0 records out
31744 bytes (32 kB) copied, 0.000715733 s, 44.4 MB/s

Looking at that bin file in an editor, I saw the string “Apple_partition_map” which is a dead givaway of what the problem was.

So, I wrote out all zeros to the first cylinder:

sudo dd bs=512 count=62 if=/dev/zero of=/dev/sdb
62+0 records in
62+0 records out
31744 bytes (32 kB) copied, 0.00165608 s, 19.2 MB/s

And then I copied the first sector (512 bytes) back from the firstCyl.bin file I had made:

summetj@constantine:~$ sudo dd bs=512 count=1 if=firstCyl.bin of=/dev/sdb
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00183878 s, 278 kB/s

And it worked! Now gparted is no longer confused by the apple (mac) partition table that I zeroed out, and sees my partition.

Leave a Reply

Your email address will not be published. Required fields are marked *