I've been trying to allocate the left unallocated free space after uninstalling the ubuntu. As there are no options available in disk utility to do that now.

Disk Utility

The unshaded part is unallocated. I tried to workaround using terminal commands but I am getting an error that I am not able to understand. I ran the command

diskutil coreStorage resizeStack FCF7976D-78ED-4CE9-8029-C6557CB601C5 429.9G JHFS+ Mac 480G

and got

The Core Storage Logical Volume UUID is FCF7976D-78ED-4CE9-8029-C6557CB601C5
Started CoreStorage operation
Checking prerequisites for resizing Logical-Physical volume stack
Error: -69722: You can't perform this resize unless it has a booter (target  partition is probably too small)

What is this error and how to get around it to get back my free space of hard drive?

Link for the commands. http://blog.fosketts.net/2011/08/05/undocumented-corestorage-commands/ You can also refer to apple's man page on diskutil

Edit1 :

~ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage Macintosh HD            429.9 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:        Bios Boot Partition                         1.0 MB     disk0s4
   5:                 Linux Swap                         4.1 GB     disk0s5
   6:           Linux Filesystem                         65.3 GB    disk0s6

/dev/disk1 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            Macintosh HD           +429.5 GB   disk1
                                 Logical Volume on disk0s2

~ sudo gpt 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  839592368      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
  840002008    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  841271544       1800
  841273344       2048      4  GPT part - 21686148-6449-6E6F-744E-656564454649
  841275392    7999488      5  GPT part - 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
  849274880  127496192      6  GPT part - 0FC63DAF-8483-4772-8E79-3D69D8477DE4
  976771072       2063
  976773135         32         Sec GPT table
  976773167          1         Sec GPT header
  • Please add the output of diskutil list and sudo gpt -r diskX with diskX: the disk identifier of the HDD (prob. disk0). Please add is as formatted text and not as screenshot. – klanomath Nov 20 '16 at 10:23
  • @klanomath here are the outputs. – Boyka Nov 23 '16 at 6:44

The command diskutil cs resizeStack ... requires some unallocated disk space at the end of a Logical Volume Group and the Recovery HD (index 2 & 3) to be able to expand it. You only have 1800 blocks à 512 Bytes (~2 MB) of it.

After installing and uninstalling Ubuntu you still have an abandoned BIOS Boot partition (probably GRUB) (index 4), a swap partition (index 5) and a main Linux partition (index 6) at the tail of your disk.

Before resizing the CS stack (which often fails with such an expelled Linux dual-boot environment), you have to delete the three Linux partitions (and change the MBR to the default pMBR).

  • Backup your internal drive
  • Detach any external drive
  • Boot to Internet Recovery Mode
  • Open Terminal in the menubar Utilities -> Terminal
  • Get an overview (especially the gpt command is important!). Below I assume the internal disk has the disk identifier disk0 and the Logical Volume residing in disk0s2 has the disk identifier disk2. Please use the disk identifiers you found in your environment:

    diskutil list
    gpt -r show disk0
  • Unmount first the Logical VOlume and then the internal disk:

    diskutil umountDisk /dev/disk2
    diskutil umountDisk /dev/disk0
  • Delete the MBR:

    dd if=/dev/zero of=/dev/disk0 bs=512 count=1
  • Destroy the GUID partition table and create a new one (this also creates a fresh pMBR):

    gpt destroy disk0
    gpt create -f disk0
  • Rebuild all previous GUID partitions:

    gpt add -i 1 -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk0
    gpt add -i 3 -b 840002008 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC disk0
    gpt add -i 2 -b 409640 -s 839592368 -t 53746F72-6167-11AA-AA11-00306543ECAC disk0

    If you get a resource busy error after one of the steps, just unmount disk0 again with

    diskutil umountDisk /dev/disk0

Check the disk with diskutil verifyDisk disk0 afterwards.

Enter diskutil cs list and check if all four CoreStorage containers appear: a Logical Volume Group, a Physical Volume and Logical Volume Family and a Logical Volume.

With the UUID of the Logical Volume mount the LV:


    +-> Logical Volume FCF7976D-78ED-4CE9-8029-C6557CB601C5
        Disk:                  disk17
        Status:                Online

Then use:

diskutil mount FCF7976D-78ED-4CE9-8029-C6557CB601C5

Then after getting the disk identifier of the mounted LV with diskutil list verify the volume:

diskutil verifyVolume disk17 #probably it's disk17, disk16 or disk18

Then try to resize the stack with:

diskutil cs resizeStack FCF7976D-78ED-4CE9-8029-C6557CB601C5 499g

If you get an error (partition is too small) use a slightly smaller value (e.g. 498500m)

The above resizeStack command may fail, due to a CS LVG "corruption". This is no corruption of your data but probably a corruption/misconfiguration of some CS meta data. Then you have to wipe your disk and restore your current (Time Machine) backup.

  • thanks for the help, but I followed another method which worked fine. I used live ubuntu bootable usb and used gparted tool to delete the unallocated drive and then again creating a new drive with ntfs format. Then I used tuxera ntfs to access the partition on my mac. Now I have both the partitions accessible. – Boyka Nov 24 '16 at 5:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .