1

So I was playing around with Disk Utility today. I created a second partition. Format is Free Space.

How do I undo this? As in, I want to have just one primary partition "Macintosh HD"

I've tried:

1) In Disk Utility, I select the partition tab. The "-" character is greyed out. As in, it cant be clicked on.

2) Rebooted in Recovery mode (CMD+SHIFT+R) and did above. Same result. The partition cannot be removed. The "-" button is greyed out. It simply cannot be clicked.

This is what diskutil list returns:

diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage                         125.4 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Macintosh HD           *125.1 GB   disk1 <---- I believe, this is the second partition I accidentally created, which I want to remove
                                 Logical Volume on disk0s2
                                 8F5A679C-06AB-44CC-BD46-33E327446D80
                                 Unencrypted
4
  • run diskutil cs list and sudo gpt -r -vv show disk0 and show the detail
    – nelson
    Commented Jan 5, 2015 at 15:34
  • @nelson We already know /dev/disk1 is a core storage LV on disk0s2 from the output pasted here.
    – bmike
    Commented Jan 5, 2015 at 15:43
  • 1
    Yes, you are right. I want to more detail to ensure your disk is safe to resize
    – nelson
    Commented Jan 5, 2015 at 15:45
  • 1
    @ChristianFazzini please add the output of diskutil cs list to your question
    – klanomath
    Commented Jan 5, 2015 at 16:48

2 Answers 2

1

The reason is that disk0 contains your actual drive. If you look there, you see that only 125.4 GB of space is allocated to the "Core Storage". Disk 1 is the logical volume (Macintosh HD) which resides in disk0s2 (also named Macintosh HD) so deleting disk1 won't be what you want to accomplish and the tool is preventing you from deleting that "logical device".

You can fix this with the cs subcommand of diskutil in terminal to remove the core storage and put things back on disk0s2 in a none-CoreStorage format.

For safety's sake, make a good backup before continuing and then revert the core storage volume:

diskutil cs revert 8F5A679C-06AB-44CC-BD46-33E327446D80

Now let the machine revert to none-CoreStorage layout. Once that's done, you can use the Disk Utility and or diskutil to resize disk0s2 to take up all the space. Then you would re-enable file vault if you want core storage going forward. This may take more time than wiping the drive and reinstalling the OS and restoring your backup - but you will learn more by using diskutil and not need to test your backup now if you've never restored it.

I personally don't see any benefit to using Core Storage unless it's for encryption, but you're free to do so. Also, there is an undocumented diskutil cs resizeStack operation that I'd be hesitant to rely upon, but if you don't care to lose the data, might be a one trick pony to get your resize done.

I'd just revert the core storage to normal storage and then grow your normal partition using Disk Utility from reading the various comments and your initial post closely.

4
  • "enable file vault" is a bad idea. according to the original screenshot, it is Unencrypted.
    – nelson
    Commented Jan 5, 2015 at 15:48
  • @nelson Fair enough. Hence the if you want in the answer :-)
    – bmike
    Commented Jan 5, 2015 at 17:02
  • after reverting corestorage and resizing the volume, diskutil cs convert should work
    – nelson
    Commented Jan 5, 2015 at 17:11
  • diskutil cs convert is a document command, it's more safe
    – nelson
    Commented Jan 5, 2015 at 17:28
0

For safety's sake, make a good backup before continuing.

I really agree with @bmike, I'd like to say, "re-enable file vault" is a bad idea, because it's Unencrypted originally, and also "file vault 2" has so many horrible bugs. if every thing is OK, diskutil cs resizeStack 8F5A679C-06AB-44CC-BD46-33E327446D80 0g should work

4
  • @klanomath 0 is correct. you can see the man page of diskutil, for example Resize a volume and create a volume after it, using all remaining space diskutil resizeVolume /Volumes/SomeDisk 50g MS-DOS DOS 0b
    – nelson
    Commented Jan 5, 2015 at 17:07
  • if you make some test you will find, 100% doesn't work in this case. maybe 250g does. diskutil cs resizeStack is an undocumented command so far
    – nelson
    Commented Jan 5, 2015 at 17:24
  • you are right diskutil cs resizeStack 8F5A679C-06AB-44CC-BD46-33E327446D80 0g works though it's not very logical. diskutil cs resizeStack 8F5A679C-06AB-44CC-BD46-33E327446D80 100% does not work, while diskutil cs resizeStack 8F5A679C-06AB-44CC-BD46-33E327446D80 248.5g works. but 0g is better because it completely fills the physical disk.
    – klanomath
    Commented Jan 5, 2015 at 22:38
  • distill doesn't allow create a zero size partition, so I think 0 is a magic number
    – nelson
    Commented Jan 6, 2015 at 1:23

You must log in to answer this question.

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