Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

GPT Surgeon

Command-line tool for repairing corruption of HFS+ partition labels on GPT-partitioned drives.

I originally noticed this corruption on an external HD in a Mac OS X/Windows Vista dual-boot setup using MacDrive 7 for HFS+ access, but some GPT Surgeon users have reported the same issue with Apple's Boot Camp drivers.

Generally this manifests as the Apple Disk Utility error "invalid BS_jmpBoot in boot block: 000000" after you've booted Windows, accessed the drive, and then booted Mac OS X. The data hasn't been lost, but the partition type GUID is wrong, and so Mac OS X can't recognize the filesystem.

See the below blog posts and their comments for more info:


Requires Python 2.5 or higher. Not tested with Python 3.

GPT Surgeon relies on direct access to device files, so you'll need to run it as root on Mac OS X, Linux, FreeBSD, etc. My instructions assume Mac OS X. It won't work as is on Windows.

Using GPT Surgeon

You'll need to know the path to the affected disk. You can use the info button in Apple's Disk Utility, or diskutil list in the Terminal. For an external disk, this will usually be /dev/disk1 or higher; if your boot disk is encrypted with FileVault, it may be /dev/disk2 or higher.

Show GPT entries for a disk:

sudo ./ list </dev/diskN>

Change the type of the selected partition on the selected disk to HFS+:

sudo ./ repair </dev/diskN> <partition number>

The partition numbers start at 0, as in the output of the list command.

I've also made a walkthrough video:

walkthrough video

Submitting bug reports

If you run into problems with GPT Surgeon and your disk, please install disktype (which you can get from Homebrew or MacPorts), and include a disktype report for the affected disk with your Github issue:

sudo disktype </dev/diskN> > disktype_report.txt


Command-line tool for repairing corruption of HFS+ partition labels on GPT-partitioned drives.







No releases published


No packages published