Can’t partition hard drive – “corrupt”, exit code 8

bootcampdisk-utilityhard drivepartition

I want to install Windows on a partition of my Mac's SSD. Therefore, I had BootCamp install Windows from an .iso file.
Unfortunately, BootCamp could not partition my drive. The error message doesn't say much; it just asks me to repair my drive via First Aid in Disk Utility.

I ran first aid on the physical disk. Result:

check ok

Next, I ran first aid on the logical volume. Result:

first aid failed

As suggested, I decided to run first aid from recovery. Since Disk Utility in recovery mode only lets me run first aid on the physical disk, the result is as expected: everything's ok.

Then, I tried manually creating a partition to boot into using a bootable USB. Disk Utility gave the following output:

partitioning failed

Now, I'm not sure how serious I should take the message "the volume xxx is corrupt and needs to be repaired", since the first aid on the physical disk says, everything is fine.

Any idea what's causing this and how I can resolve it?
If possible, I'd rather not reformat the drive, except if it's necessary.


Edit:

As requested by @klanomath, I ran the command sudo gpt -r show disk0 in terminal. This is the output:

    start       size  index  contents
        0          1         PMBR
        1          1         Pri GPT header
        2         32         Pri GPT table
       34          6         
       40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
   409640  975425848      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
975835488    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
977105024          3         
977105027         32         Sec GPT table
977105059          1         Sec GPT header

Edit #2:

In internet recovery mode, I ran the command diskutil list, which returned this list:

result of diskutil list

I was not sure whether I should use disk1 or disk2, so I tried running diskutil verifyVolume diskX on both of them. For disk1, I received a message saying invalid request. For disk2, the following result and error message was displayed:

result of diskutil verifyVolume disk2

I then tried running the command diskutil repairVolume diskX, again for both disks. Same error message for disk1, following output for disk2:

result of diskutil repairVolume disk2

Best Answer

Your main volume has a minor error (orphaned blocks - invalid volume free block count) which usually can be fixed with diskutil repairVolume diskIdentifier entered in Terminal.app booted from another volume or disk.

  • Either boot to Recovery Mode (cmdR while booting) or Internet Recovery Mode (altcmdR while booting).

  • In the menubar > Utilities open Terminal

  • Enter diskutil list to get the disk identifier of your main volume.

    • with CoreStorage disabled that's usually disk0s2
    • with CoreStorage enabled that's usually disk2 or in the upper tenth (e.g. disk17). It's the one with the (internal, virtual) supplement.

      If it wasn't mounted enter diskutil cs list to get the Logical Volume UUID and try to mount it with diskutil cs unlockVolume UUID (replace UUID here with the UUID found previously). Repeat diskutil list to get the disk identifier.

  • Now check the volume with diskutil verifyVolume diskXsY (normal volume) or diskutil verifyVolume diskX (CoreStorage volume).
  • Then try to repair the volume with diskutil repairVolume diskXsY (normal volume) or diskutil repairVolume diskX (CoreStorage volume).