Cannot resize OS X partition
Solution 1:
I had this exact same issue, OS X couldn't move the files to allow the partition to be resized. I went and got Coriolis iDefrag, it created a boot DVD with iDefrag on it that allowed it to do the job perfectly.
It's worth noting that for normal use of a Mac you never need to defrag, since files are defragged on-the-fly, but in this case we're wanting to defrag the free space, including some files that are 'locked'.
As always it's a good idea to backup your data first.
I was able to partition as much as I liked for Boot Camp once iDefrag was done (before it wouldn't even let me do 5Gb, afterwards I did a 100Gb partition).
Solution 2:
Super question necromancy since I couldn't find the answer to this anywhere.
When resizing your HFS+ partition fails, there should be a log entry similar to: hfs_reclaimspace: Error reclaiming datafork blocks of fileid=<inode>
created in the "All Messages" section of Console.app. find -x / -inum <inode>
will tell you which file prevented the resize.
Knowing what file caused the problem allows you to delete that file or move it to another disk and move it back or something, allowing you to complete your resize without reformatting or purchasing a defragmentation program.
I had to do this twice(only two problem files) before my resize completed. I've only tested this with the diskutil
command for resizing, but it should be the same with Disk Utility.app because the message comes from the kernel.
Solution 3:
In some cases a problem like this can be caused by bad system-volume information. Try using a utility like Disk Warrior to make sure your HFS+ volume has all of its values set correctly. Short of that, you could try using the Disk Utility from your OS X install disk instead of trying to resize the partition while booted from it.
Solution 4:
this is a simple to deal with the partition failed error
You need to reboot your mac into single user mode. In order to do this, you need to hold press ⌘-S
You then need to run fsck - which checks your drive. Run `/sbin/fsck -fv' the f is for force and the v for verbose.
reboot the system to get out of single user mode - with
exit
orreboot
verify the disk from disk utility, then partition the disk again
source