How to fix partitions if disk utility is not able to?
I ask my question regardless of how I came to this point to make it more generally usable.
Disk utility is not able to fix my partitions. First partition is OS X (runs fine), second one is Windows (non bootable at the moment). I used rEFInd for booting.
It would be alright to delete Windows and just resize OS X. But how?
My partitions look like this
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 234441614
Partitions will be aligned on 8-sector boundaries
Total free space is 56299597 sectors (26.8 GiB)
Number Start (sector) End (sector) Size Code Name
1 40 409639 200.0 MiB EF00 EFI System Partition
2 409640 98749479 46.9 GiB AF00 BVMACPRO
3 98749480 100019015 619.9 MiB AB00 Recovery HD
4 156317696 234440703 37.3 GiB 0700 BOOTCAMP
MBR looks like this:
Number Boot Start Sector End Sector Status Code
1 1 409639 primary 0xEE
2 409640 98749479 primary 0xAF
3 98749480 100019015 primary 0xAB
4 156317696 234440703 primary 0x0C
gpt output is:
$ sudo gpt -r show disk0
gpt show: disk0: Suspicious MBR at sector 0
start size index contents
0 1 MBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
409640 98339840 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
98749480 1269536 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
100019016 56298680
156317696 78123008 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
234440704 911
234441615 32 Sec GPT table
234441647 1 Sec GPT header
fdisk
$ sudo fdisk /dev/disk0
Disk: /dev/disk0 geometry: 14593/255/63 [234441648 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: EE 1023 254 63 - 1023 254 63 [ 1 - 409639] <Unknown ID>
2: AF 1023 254 63 - 1023 254 63 [ 409640 - 98339840] HFS+
3: AB 1023 254 63 - 1023 254 63 [ 98749480 - 1269536] Darwin Boot
4: 0C 1023 254 63 - 1023 254 63 [ 156317696 - 78123008] Win95 FAT32L
I tried resizing the first partition via command line.
$ sudo diskutil resizevolume /dev/disk0s2 R
Started partitioning on disk0s2 BVMACPRO
Verifying the disk
Checking file system
Performing live verification
Checking Journaled HFS Plus volume
Checking extents overflow file
Checking catalog hierarchy
Checking extended attributes file
Resizing
Error: -69742: The requested size change for the target disk or a related disk is too small; please try a different disk or partition, or make a larger change
Solution 1:
You should be able to delete the Windows partition, which will allow you to resize the OS X partition.
Normally you can simply click on the expansion icon located in the bottom corner of your OS X volume, which allows for easy resizing. However, Disk Utility won't allow this if there is another partition below the one you want to resize:
https://support.apple.com/kb/PH22240
Enlarge a volume If you have multiple volumes on a device and one of them is running out of space, you may be able to enlarge it without losing any of the files on it.
To enlarge a volume, you must delete the volume that comes after it on the device, then move the end point of the volume you want to enlarge into the freed space. You can’t enlarge the last volume on a device.