Can't partition hard drive - "corrupt", exit code 8
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).