Adding a Mac partition to an external drive
I recently bought a 2 TB USB disk for backups, and without much planning proceeded to put disk images from a couple of Windows laptops on to the factory formatted NTFS partition. A few months later I decided I also wanted to backup my Mac to this disk, which is where the problems started.
Firstly, in order to use Time Machine, I needed a HFS+ partition to back up to. Secondly, my Mac, running Sierra, won't write to NTFS, so I couldn't even do a manual backup to the existing partition.
So I needed to shrink the NTFS partition and add a HFS+ one. My first stop was my Mac's Disk Utility, but it had its 'Partition' button greyed out with the tooltip "Disks with Master Boot Record partition maps can not [sic] be partitioned".
Out of the frying pan
My next thought was to use Linux to shrink the partition and convert the partition table to GPT, and then Disk Utility should be happy to add partitions to the disk. The shrinking and conversion was achieved smoothly with a combination of GParted and gdisk, but when I attached the disk to my Mac again, it still saw a 2 TB partition instead of the new 1 TB size I had selected.
At this point I'm not entirely sure what went wrong or who was to blame — the suspects include Disk Utility's First Aid option, gdisk and yours truly — but to cut a long story short, I somehow ended up with just a protective MBR and no GPT, which I fixed by instructing testdisk to create a new GPT partition with the sector boundaries I was thankfully able to recover from my terminal history!
Out of the woods?
Now the Mac and Disk Utility finally recognised my 1 TB partition and 1 TB free space. However, when I tried to add a new partition, the + and - symbols were greyed out. So I created the partition in GParted instead. Then I swapped the disk back to my Mac once more to format my new partition. This seemed to be going well at first — the 'Erase' option was available and I could select the HFS+ variant to use — but then I got the inevitable error: "MediaKit reports not enough space on device for requested operation."
Partitioning was already done, so space shouldn't have been an issue. A search on the error message revealed that Apple won't do business with just any GPT disk: it has to be an Apple-compliant GPT disk. Specifically, this means that there has to be a 200 MB EFI system partition (ESP) at the beginning of the disk and all other partitions have to have 128 MB of free space afterwards. This also explains why Disk Utility wouldn't allow me to add a partition.
Jumping through Apple's hoops
Next, I attempted to meet Apple's GPT requirements by asking GParted to make space for an ESP at the beginning of my disk, but as the estimated time for this operation climbed to around 30 hours, I thought again about using MBR (thankfully GParted seamlessly reversed the partially completed shifting of my NTFS partition in a much shorter time). Disk Utility may not agree to add partitions to an MBR disk, but that shouldn't mean it won't format existing MBR partitions.
So I got gdisk to revert the disk back to MBR and added an unformatted HFS+ partition, recklessly not leaving any 128 MB gap in between. Sure enough, the Mac recognised this new partition as well as the shrunken NTFS one, and Disk Utility happily performed a journaled HFS+ format operation.
Summary
Thanks for the useful information re. adding a Mac partition to an external drive. Very helpful!
ReplyDelete