How do I merge a partition together on OSX 10.8.4 using diskutil?

Discussion in 'Mac Basics and Help' started by becauseoftacos, Oct 2, 2013.

  1. becauseoftacos macrumors newbie

    Joined:
    Apr 30, 2013
    Location:
    Western Australia
    #1
    Hi I am having a bit of trouble merging two partitions together in OSX 10.8.4.

    Disk Utility won't let me do it. So I really need someone to help me with this.

    Here is where I use the command
    Code:
    diskutil list
    Code:
    SpartaMan222s-MacBook-Pro:~ becauseoftacos$ diskutil list
    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *750.2 GB   disk0
       1:                        EFI                         209.7 MB   disk0s1
       2:                  Apple_HFS becauseoftacos HD       467.6 GB   disk0s2
       3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
       4:                  Apple_HFS to merge                151.4 GB   disk0s4
       5:                  Apple_HFS Recovery HD             650.0 MB   disk0s5
    I want to merge 'becauseoftacos HD' with 'to merge'.

    Could someone help me?
     
  2. ElectricSheep macrumors 6502

    ElectricSheep

    Joined:
    Feb 18, 2004
    Location:
    Wilmington, DE
    #2
    You cannot merge these two partitions because they are not adjacent to each other. From the manual page of the diskutility command:

    Code:
     mergePartitions [force] format name fromDevice toDevice
                    Merge two or more partitions on a disk.  All data on merged partitions other than the first will be lost.  Data on the first partition will be lost as well if the force argument is given.
    
                    If force is not given, and the first partition has a resizable file system (e.g. JHFS+), the file system will be preserved and grown in a data-preserving manner; your format and name parameters
                    are ignored in this case. If force is not given, and the first partition is not resizable, you are prompted if you want to format.  You will also be prompted to format if the first partition has
                    an (HFS) Allocation Block Size which is too small to support the required growth of the first partition; see the -b option for newfs_hfs (8).
    
                    If force is given, the final resulting partition is always (re)formatted. You should do this if you wish to (re)format to a new file system type.  You will be prompted to confirm.
    
                    Format and name must always be given, but they have an effect only when force is given.
    
                    Merged partitions are required to be ordered sequentially on disk (see diskutil list for the actual on-disk ordering).  All partitions in the range, except for the first one, must be unmountable.
                    Ownership of the affected disk is required.
    You must merge slice 2, 3, and 4 together if you want to combine the two partitions that you desire. This will also destroy the data on those partitions that are not the first.
     
  3. becauseoftacos thread starter macrumors newbie

    Joined:
    Apr 30, 2013
    Location:
    Western Australia
    #3
    I'm alright to delete one of the Recovery HD's.

    So how would I go about merging them?
     
  4. Fishrrman macrumors G3

    Joined:
    Feb 20, 2009
    #4
    My thoughts only (others' may be different)...

    If you have two partitions, and you want to end up with _one_ partition that has the combined data from both [previous] partitions, the best way to do it might be:

    1. Copy the contents of the partition you wish to delete to an EXTERNAL DRIVE.

    2. Delete the partition

    3. Copy the contents from the external drive to the remaining partition (this assumes that the remaining partition is large enough to hold everything).

    If #3 above doesn't work for you, you may have to re-work the entire drive to re-size the partitions to be more to your needs.

    Really, the best way to do this is BACK UP EVERYTHING (shouting intentional) to one or more external drives. Then, re-initialize and re-partition the internal drive. Then, one-by-one, restore the partitions using the data from the external drives.

    You are in essence "re-constructing" your internal drive. I would STRONGLY SUGGEST that you use CarbonCopyCloner in this process. If you clone your internal boot partition to an external drive, you can then boot from that to do your re-constructive work.
     
  5. becauseoftacos thread starter macrumors newbie

    Joined:
    Apr 30, 2013
    Location:
    Western Australia
    #5
    This may or may not have anything to do with this, but I'll give it a go anyway.

    I also wanted to use Boot Camp Assistant, but it tells me that I don't have enough space left, (when I have over 100gb free).

    I wiped my hard drive before. (With time machine backup) and it still did the same error. Can someone give me a centralised set of steps of what to do?
     

Share This Page