Merging Partitions on Device with Mojave

Discussion in 'macOS Mojave (10.14)' started by DuncanGarp, May 25, 2019.

  1. DuncanGarp, May 25, 2019
    Last edited: May 25, 2019

    DuncanGarp macrumors regular

    DuncanGarp

    Joined:
    Sep 6, 2018
    #1
    Hello Folks

    I have a Macbook Pro Mid 2012 (on Mojave) that has an internal SSD disk with 2 partitions:
    1. MommyMerge (APFS format) - Partition #1
    2. DaddyTemp (HFS+ format) - Partition #2
    ran diskutil list and here's terminal display:

    Screen Shot 2019-05-25 at 7.52.37 PM.png

    I've been trying to delete the 2nd partition and merge it into the 1st.
    Ran Disk Utility but haven't had any luck.
    Tried these:
    • Erase partition #2 but cannot delete it.
    • Resize partition #1 but cannot.
    None of these is core storage, and the other weird thing is that partition #2 is defined as Apple Boot although partition #1 is what I boot into. Checked System Preferences | Starting Disk to verify.
    My goal is to only have 1 partition to boot to and also store all my data.

    Any suggestions? Thanks.
     
  2. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #2
    The problem here is DaddyTemp is partition one (not two) and there is no way to erase it because it is "above" the other volume.

    The easiest thing at this point would be to just make a Time Machine backup to a local USB drive, then option key boot to that drive. Then from there in DU select show all devices, then select the drive itself at the very top and erase the whole thing to APFS. Then restore the TM backup.

    Screen Shot 2019-05-26 at 6.23.14 AM.png Screen Shot 2019-05-26 at 6.23.06 AM.png
     
  3. haralds macrumors 6502a

    haralds

    Joined:
    Jan 3, 2014
    Location:
    Silicon Valley, CA
    #3
    I would use Carbon Copy Cloner instead of TimeMachine. I have found it to be faster than TM and able to create a bootable drive.
     
  4. treekram, May 26, 2019
    Last edited: May 26, 2019

    treekram macrumors 68000

    Joined:
    Nov 9, 2015
    Location:
    Honolulu HI
    #4
    I wanted to try this out myself to see what happens. The advice given in post #2 won't change - you can't expand the APFS partition - but it turns out that if you had put the APFS partition first and the HFS+ second, you would have been able to.

    These are for example only, but if you had the APFS partition first, you can erase the HFS+ and Recovery partition? (it's the typical size for a Recovery partition although it's usually named "Recovery HD"), you would enter:

    sudo diskutil eraseVolume free free /dev/disk0s2
    sudo diskutil eraseVolume free free /dev/disk0s3

    Then, you would enter:
    sudo diskutil ap resizeContainer /dev/disk1 0

    (Again, this is for people who want to do what the OP wants to do but who put the APFS partition first. You have to use the disk/partition number which correspond to your specific situation - not necessarily these same numbers.)

    I tried this out on a 1TB HDD and when the HFS+ partition was first, when I deleted the HFS+ partitions and enter the following command (where disk6s3 is the diskutil list "Apple_APFS Container disk X" entry)

    sudo diskutil ap resizeContainer /dev/disk6s3 limits

    I get:
    Resize limits for APFS Physical Store partition disk6s3:
    Current Physical Store partition size on map: 499.9 GB (499930456064 Bytes)
    Minimum (constrained by file/snapshot usage): 78.0 GB (78014054400 Bytes)
    Recommended minimum (if used with macOS): 88.8 GB (88751472640 Bytes)
    Maximum (constrained by partition map space): 499.9 GB (499930456064 Bytes)

    So it's telling me I'm at the maximum size. In the manpage, it says the following: "Grows are constrained by the amount of partition map free space trailing the targeted or implied Physical Store partition."

    When I enter the following command (disk7 being the synthesized container):

    sudo diskutil ap resizeContainer /dev/disk7 0

    I get:
    Error: -69743: The new size must be different than the existing size

    However, same situation - but the APFS partition is first and I create a HFS+ partition second (disk6s2 is the "Apple_APFS Container disk X" entry, after I run the disktutil eraseVolume command)

    sudo diskutil ap resizeContainer /dev/disk6s2 limits

    I get:
    Resize limits for APFS Physical Store partition disk6s2:
    Current Physical Store partition size on map: 500.1 GB (500064673792 Bytes)
    Minimum (constrained by file/snapshot usage): 81.8 GB (81805705216 Bytes)
    Recommended minimum (if used with macOS): 92.5 GB (92543123456 Bytes)
    Maximum (constrained by partition map space): 1000.0 GB (999994101760 Bytes)

    Notice the maximum is now the size of the 1TB disk. When I then enter

    sudo diskutil ap resizeContainer /dev/disk7 0

    it goes and resizes the container to 1000.0GB.

    (This was done on a HDD - maybe it's different on a SSD considering what the man page says, I wouldn't think so.)
     
  5. DuncanGarp, May 26, 2019
    Last edited: May 26, 2019

    DuncanGarp thread starter macrumors regular

    DuncanGarp

    Joined:
    Sep 6, 2018
    #5
    Thanks @Weaselboy for the response and suggestion. One question regarding your suggestion. Is the USB drive for the TM bootable?
    --- Post Merged, May 26, 2019 ---
    Thanks @haralds for the suggestion. I'm going to try Carbon Copy Cloner for this if the @Weaselboy won't work. Does Carbon Cloner defaults to creating the USB TM backup bootable?
    --- Post Merged, May 26, 2019 ---
    Mahalo @treekram for your input. If previous posts somehow fail, I will try yours.
    For these on your example:
    sudo diskutil eraseVolume free free /dev/disk0s2
    sudo diskutil eraseVolume free free /dev/disk0s3
    Is there a way to switch my APFS and HFS+ partitions?

    One more request for clarification. Based on your examples, can you please use the "disk#s#" based on my screenshot? Mahalo again.

    ~~~
     
  6. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #6
    Yeah... APFS is much more flexible in this regard. If the drive is all APFS, it is very easy to manipulate and move around the "containers"

    It can be booted to the recovery volume on the TM disk, then used to erase the drive and restore. It cannot be booted to the OS to actually operate the Mac like a CCC clone can.
     
  7. treekram macrumors 68000

    Joined:
    Nov 9, 2015
    Location:
    Honolulu HI
    #7
    You can't use the method I outlined because your HFS+ partition is the first one. If your APFS partition was first, it would work. I wrote down the steps for people who may come across this thread and who have the APFS partition first.
     
  8. DuncanGarp thread starter macrumors regular

    DuncanGarp

    Joined:
    Sep 6, 2018
    #8
    Continuing with my container merge issue.
    • Did the backup of my two container internal SSD on Mojave.
    • Booted up into an external SSD with Sierra.
    • Used Disk Utility to erase my 2 containers on Mojave.
    • Now my internal SSD only has 1 container (formatted as APFS).
    • Restored my latest TM backup into my internal SSD that is now merged.
    • Now I can't boot into that drive (Mommy.SSD.256gb.
    Please review my screenshots:
    Screen Shot 2019-05-27 at 12.58.11 PM.png
    Screen Shot 2019-05-27 at 12.58.51 PM.png
    Screen Shot 2019-05-27 at 1.05.58 PM.png

    Any help or suggestion is appreciated.
     
  9. treekram, May 27, 2019
    Last edited: May 27, 2019

    treekram macrumors 68000

    Joined:
    Nov 9, 2015
    Location:
    Honolulu HI
    #9
    It looks like what happened is that when you did the Time Machine restore, it did not take the proper steps to create a bootable disk. If you notice your green screenshot, it only has 1 volume in the synthesized partition vs. 4 in your original screenshot. What you would need to do is
    1) Boot up the machine in High Sierra from the external SSD (you said Sierra, but it must have been High Sierra since it formatted the internal SSD to APFS).
    2) Download the Mojave installer if you don't already have one - you might have one in the Applications folder called "Install macOS Mojave". If you don't have it, go into the App Store and download it there. You might want to copy the Installer to a separate disk to have it for future use since it tends to get deleted after you install Mojave.
    3) I don't know how the Installer would handle your situation. If it would try to use what you've already restored or if it will delete it or if it will get confused. So it would be your choice - either re-erase the partition and create a new APFS partition or leave it and hope for the best. I would just erase the partition.
    4) Run the Install application targeting the internal SSD. If your internal SSD isn't shown as a selectable install target, there should be a button that says "Show all disks" or something to that effect - press that button and select the internal SSD. As part of the install, it will ask if you want to transfer data. If you didn't keep your existing container then as part of the install, then say yes and tell it to transfer data from your Time Machine backup. If you decided to keep your existing container, then after the install finished, check to see if your data is there.
    5) Hopefully the install works properly. Once it's done, I always like to turn the machine off and re-start as sometimes if that isn't done (for me, at least), it acts a bit wonky.
    6) If you tried to keep your original container and the installer deleted it, run the Migration Assistant app (in the Application/Utilities folder) and it can restore from your Time Machine backup.
     
  10. DuncanGarp thread starter macrumors regular

    DuncanGarp

    Joined:
    Sep 6, 2018
    #10
    Finally accomplished what I intended. Now my SSD has a single partition.

    Screen Shot 2019-05-27 at 9.39.28 PM.png

    I'm just wondering what the "VM" signifies. No big deal but it occupies 1.1 GB.

    Thanks @Weaselboy, @haralds and @treekram for the tips.
     
  11. treekram macrumors 68000

    Joined:
    Nov 9, 2015
    Location:
    Honolulu HI
    #11
    With APFS, Apple has seen fit to allocate a volume ("VM") to the /var/vm directory, which is only supposed to be used by the OS. If there are files in this directory, it's usually swap files (when the system runs out of RAM) and the sleepimage file (most often used on laptops to prolong battery life). On my main system (not a laptop), the /var/vm/sleepimage file is 2GB (as is the case with at least a couple of my other Macs). This file supposedly shouldn't be created since I have set hibernatemode=0, but I think I've deleted the file (you have to have SIP disabled to do this) and tried one of the suggestions to to try to prevent it's creation but it comes back so I've ignore it - maybe I'll need to try some of the other suggestions.
     

Share This Page

10 May 25, 2019