Skip to content

Instantly share code, notes, and snippets.

@mrietveld
Last active May 5, 2018 21:25
Show Gist options
  • Save mrietveld/b1b07820d86a9556bdd410b2511302f5 to your computer and use it in GitHub Desktop.
Save mrietveld/b1b07820d86a9556bdd410b2511302f5 to your computer and use it in GitHub Desktop.
Mac Partitioning Tips

StackExchange (Apple): Rebuild partition table on external HDD - not writable
StackExchange (Apple): Partition map rebuild

Handy commands (as root, of course)

  • diskutil unmountDisk /dev/disk2
  • Remove the EFI partition:
    • gpt remove -i 1 /dev/disk2
  • Destroy and recreate an empt partition table:
    • sudo gpt destroy /dev/disk2
    • sudo gpt create /dev/disk2
  • Re-add the EFI partition:
    • gpt add -b 40 -i 1 -s 409600 -t
  • Show the partition table info:
    • Including starting blocks: gpt -r show /dev/diskdisk2
    • diskutil list disk2
  • Add a new partition:
    • gpt add -b <StartBlock> -i <IndexNumber> -s <SizeOfVolume> -t hfs disk2
    • For example: gpt add -b 409640 -i 2 -s 1465105374 -t hfs disk2
  • Change the FS type of the new partition to case-sensitive and set the label:
    • newfs_hfs -s -v BackupHome /dev/disk2s3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment