Disk Utility fails to restore my disk to single partition after removing a partition for Windows using boot camp

Removed the partition for Windows using bootcamp, the partition space went to a new partition named Free space.

User uploaded file

Even the "Free space"partition cannot be merged with the startup disk manually using Disk Utility.

User uploaded file

It is recommended to run a whole disk recovery or repair, which I have no idea how.

User uploaded file

Running First Aid on the whole disk, error message as "Incorrect size" showed.

User uploaded file

MacBook (Retina, 12-inch, Early 2015), macOS Sierra (10.12), Input method, Cangjie

Posted on Jun 20, 2017 12:16 AM

Reply
19 replies

Jun 23, 2017 5:06 AM in response to Kit Yen

You have either El Capitan or Sierra. You will need to disable SIP temporarily by booting into Local Recovery (using Command+R - not Internet Recovery) and click on Utilities -> Terminal and type


csrutil status

csrutil disable

csrutil status


Boot normally and check the output of csrutil status which should now be disabled.


Once SIP is disabled, we need to create a Fake entry for GPT4, you can use BC Assistant to restore the partition to a single partition using Boot Camp for Mac: Remove Windows from your Mac . In the following commands, (do not enter text like this).


sudo gdisk /dev/disk0

x (Experts menu)

l (Lowercase 'L', set sector alignment to ...)

1 (...one sector)

m (Main menu)

n (New)

4 (GPT4)

47197795 (Start sector)

+14081544 (Size. Notice the '+' sign)

p (Print)

w (Write)

y (Confirm Write)

q (Quit Gdisk, if necessary)


diskutil repairDisk disk0


Now try to remove the partition using BC Assistant only.

Jun 23, 2017 12:23 AM in response to Loner T

gpt show: /dev/disk0: mediasize=251000193024; sectorsize=4096; blocks=61279344

gpt show: /dev/disk0: PMBR at sector 0

gpt show: /dev/disk0: Pri GPT at sector 1

gpt show: /dev/disk0: Sec GPT at sector 61279343

start size index contents

0 1 PMBR

1 1 Pri GPT header

2 4 Pri GPT table

6 76800 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B

76806 46962297 2 GPT part - 53746F72-6167-11AA-AA11-00306543ECAC

47039103 158692 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC

47197795 14081544

61279339 4 Sec GPT table

61279343 1 Sec GPT header

Jun 23, 2017 7:46 AM in response to Loner T

GPT fdisk (gdisk) version 1.0.1


Warning: Devices opened with shared lock will not have their

partition table automatically reloaded!

Partition table scan:

MBR: protective

BSD: not present

APM: not present

GPT: present


Found valid GPT with protective MBR; using GPT.


Command (? for help): x


Expert command (? for help): l

Enter the sector alignment value (1-65536, default = 2048): 1


Expert command (? for help): m


Command (? for help): n

Partition number (4-128, default 4): 4

First sector (47197795-61279338, default = 47197795) or {+-}size{KMGTP}: 47197795

Last sector (47197795-61279338, default = 61279338) or {+-}size{KMGTP}: +14081544

Current type is 'Apple HFS/HFS+'

Hex code or GUID (L to show codes, Enter = AF00): p

Hex code or GUID (L to show codes, Enter = AF00): w

Hex code or GUID (L to show codes, Enter = AF00): l

0700 Microsoft basic data 0c01 Microsoft reserved 2700 Windows RE

3000 ONIE boot 3001 ONIE config 3900 Plan 9

4100 PowerPC PReP boot 4200 Windows LDM data 4201 Windows LDM metadata

4202 Windows Storage Spac 7501 IBM GPFS 7f00 ChromeOS kernel

7f01 ChromeOS root 7f02 ChromeOS reserved 8200 Linux swap

8300 Linux filesystem 8301 Linux reserved 8302 Linux /home

8303 Linux x86 root ✅ 8304 Linux x86-64 root (/ 8305 Linux ARM64 root ✅

8306 Linux /srv 8307 Linux ARM32 root ✅ 8400 Intel Rapid Start

8e00 Linux LVM a500 FreeBSD disklabel a501 FreeBSD boot

a502 FreeBSD swap a503 FreeBSD UFS a504 FreeBSD ZFS

a505 FreeBSD Vinum/RAID a580 Midnight BSD data a581 Midnight BSD boot

a582 Midnight BSD swap a583 Midnight BSD UFS a584 Midnight BSD ZFS

a585 Midnight BSD Vinum a600 OpenBSD disklabel a800 Apple UFS

a901 NetBSD swap a902 NetBSD FFS a903 NetBSD LFS

a904 NetBSD concatenated a905 NetBSD encrypted a906 NetBSD RAID

ab00 Recovery HD af00 Apple HFS/HFS+ af01 Apple RAID

af02 Apple RAID offline af03 Apple label af04 AppleTV recovery

af05 Apple Core Storage bc00 Acronis Secure Zone be00 Solaris boot

bf00 Solaris root bf01 Solaris /usr & Mac Z bf02 Solaris swap

bf03 Solaris backup bf04 Solaris /var bf05 Solaris /home

bf06 Solaris alternate se bf07 Solaris Reserved 1 bf08 Solaris Reserved 2

Press the <Enter> key to see more codes:

bf09 Solaris Reserved 3 bf0a Solaris Reserved 4 bf0b Solaris Reserved 5

c001 HP-UX data c002 HP-UX service ea00 Freedesktop $BOOT

eb00 Haiku BFS ed00 Sony system partitio ed01 Lenovo system partit

ef00 EFI System ef01 MBR partition scheme ef02 BIOS boot partition

f800 Ceph OSD f801 Ceph dm-crypt OSD f802 Ceph journal

f803 Ceph dm-crypt journa f804 Ceph disk in creatio f805 Ceph dm-crypt disk i

fb00 VMWare VMFS fb01 VMWare reserved fc00 VMWare kcore crash p

fd00 Linux RAID

Hex code or GUID (L to show codes, Enter = af00):



(I didn't finish the commands you provided)

Jun 24, 2017 3:11 AM in response to Loner T

GPT fdisk (gdisk) version 1.0.1


Warning: Devices opened with shared lock will not have their

partition table automatically reloaded!

Partition table scan:

MBR: protective

BSD: not present

APM: not present

GPT: present


Found valid GPT with protective MBR; using GPT.


Command (? for help): x


Expert command (? for help): l

Enter the sector alignment value (1-65536, default = 2048): 1


Expert command (? for help): m


Command (? for help): n

Partition number (4-128, default 4): 4

First sector (47197795-61279338, default = 47197795) or {+-}size{KMGTP}: 47197795

Last sector (47197795-61279338, default = 61279338) or {+-}size{KMGTP}: +14081544

Current type is 'Apple HFS/HFS+'

Hex code or GUID (L to show codes, Enter = AF00): 0700

Changed type of partition to 'Microsoft basic data'


Command (? for help): p

Disk /dev/disk0: 61279344 sectors, 233.8 GiB

Logical sector size: 4096 bytes

Disk identifier (GUID): BA025183-B488-4DBF-8A65-A2CD391ECBF1

Partition table holds up to 128 entries

First usable sector is 6, last usable sector is 61279338

Partitions will be aligned on 1-sector boundaries

Total free space is 0 sectors (0 bytes)


Number Start (sector) End (sector) Size Code Name

1 6 76805 300.0 MiB EF00 EFI System Partition

2 76806 47039102 179.1 GiB AF05 Customer

3 47039103 47197794 619.9 MiB AB00

4 47197795 61279338 53.7 GiB 0700 Microsoft basic data


Command (? for help): w


Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING

PARTITIONS!!


Do you want to proceed? (Y/N): y

OK; writing new GUID partition table (GPT) to /dev/disk0.

Warning: Devices opened with shared lock will not have their

partition table automatically reloaded!

Warning: The kernel may continue to use old or deleted partitions.

You should reboot or remove the drive.

The operation has completed successfully.

Jun 24, 2017 6:29 AM in response to Kit Yen

Kit Yen wrote:


Number Start (sector) End (sector) Size Code Name

1 6 76805 300.0 MiB EF00 EFI System Partition

2 76806 47039102 179.1 GiB AF05 Customer

3 47039103 47197794 619.9 MiB AB00

4 47197795 61279338 53.7 GiB 0700 Microsoft basic data


This shows a 179GiB OSX and 53 GiB Windows.


1. Did you run the repairDisk command after the GDisk steps were complete?

2. Did you remove the partition successfully after these steps were complete?

Jun 24, 2017 7:47 PM in response to Loner T

Yes, I have tired to remove the partition for windows manually, using Disk Utility, after the first time the BC assistant's failure to restore disk to single partition.


AS PER YOUR REQUEST

gpt show: /dev/disk0: mediasize=251000193024; sectorsize=4096; blocks=61279344

gpt show: /dev/disk0: PMBR at sector 0

gpt show: /dev/disk0: Pri GPT at sector 1

gpt show: /dev/disk0: Sec GPT at sector 61279343

start size index contents

0 1 PMBR

1 1 Pri GPT header

2 4 Pri GPT table

6 76800 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B

76806 46962297 2 GPT part - 53746F72-6167-11AA-AA11-00306543ECAC

47039103 158692 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC

47197795 14081544 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

61279339 4 Sec GPT table

61279343 1 Sec GPT header

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Disk Utility fails to restore my disk to single partition after removing a partition for Windows using boot camp

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.