2

I am running macOS Sierra 10.12.5 on the 4th partition of my HDD. The partitions in order:

Partition 1, 280 MB: EFI
Partition 2, 22 GB: Storage 1
Partition 3, 186 GB: Storage 2
Partition 4, 110 GB: Macintosh HD
Partition 5, 600 MB: Recovery HD

Storage 2 has 102 GB available, and Macintosh HD only has 66 GB used, so space is not a problem. I need to copy my macOS installation from Macintosh HD to Storage 2, so that I can delete Macintosh HD, and expand Storage 2 to include the now free 110 GB. The catch is that I need to preserve all the data on both partitions while copying the installation. User data, system preferences, my command line package managers, everything. Plus in doing so I need Storage 2 to become a bootable volume. Neither reinstalling macOS, wiping Storage 2 for a restore from Macintosh HD, or wiping and repartitioning the whole disk are options here (I don't have a spare drive large enough to store all that data on.).

I have tried a simple sudo cp -R / /Volumes/Storage\ 2/ (from in-OS that is), but some files have read/copy permissions denied even to the root user, and that's with SIP off. So... anyone have any ideas? I'm not partial to either the GUI or command line, so long as it gets the job done. Thanks in advance!

  • I understand your questing and I don't have an answer, but IMHO you can try to move 40 Gb of non-system files (that are movable) to Storage 2, cleanup Storage 1 (also by moving them to Storage 2), clone Macintosh HD to Storage 1. Then boot from Storage 1 and merge those 3 partitions to one single. And even if you will boot from Storage 1, I still not sure that you will be able to repartition Storage 2 and Macintosh HD because unexpected and unexplained partition errors is a really often case in my experience. – toma Jul 2 '17 at 14:57
  • @toma While your suggestion would likely work, I should add that Storage 1 is currently reserved for other things, and needs to remain a separate partition. See, my Recovery HD partition hasn't worked since Mavericks, and I'd been having to use an installer USB as a recovery drive. Since I've decided to clone the installer USB for each new macOS release to Storage 1, and use it as an installer/recovery combo. I have potentially found an answer in the bash program ditto, however. – Alison E.E. Jul 2 '17 at 18:39
1

Well, I managed to achieve what I needed using the following procedure:

1.) sudo -i
Enter root shell

2.) mkdir /Volumes/Storage\ 2/Data/ && mv /Volumes/Storage\ 2/* /Volumes/Storage\ 2/Data/ && mv /Volumes/Storage\ 2/.* /Volumes/Storage\ 2/Data/
This relocated all my data on the target volume to a separate folder

3.) ditto -X -V --nocache / /Volumes/Storage\ 2/
This copied all files and symlinks from my boot volume to the volume "Storage 2", and made "Storage 2" bootable in the process.

4.) reboot > Storage 2
Booted into Storage 2

5.) diskutil eraseVolume "Free Space" Macintosh\ HD disk0s4
Deleting the old boot volume, and leaving free space in its place

6.) diskutil resizeVolume disk0s3 296G
Expand the new boot volume to include the free space I just made

7.) diskutil rename disk0s3 Macintosh\ HD
Renamed new boot volume to match old one

8.) diskutil eraseVolume "Free Space" Recovery\ HD disk0s5
Delete faulty recovery partition

9.) diskutil resizeVolume disk0s3 296.6G
Expand new boot volume to include rest of free space

Since performing this half of my two-part project the partition scheme now looks like this:

Partition 1, 210 MB: EFI
Partition 2, 22 GB: Storage 1
Partition 3, 297 GB: Macintosh HD

Hopefully this will be helpful for anyone else who needs to move their macOS installation to another partition without losing any data, or anyone who needs to make a bootable backup of their system before performing a potentially dangerous operation.

Now that this part is done, I just need to figure out how to turn "Storage 1" into a bootable installer partition.

  • step 5, 6, 8 and 9 can be summarized as diskutil mergePartitions disk0s3 disk0s5. – klanomath Jul 3 '17 at 19:59
  • @klanomath They could indeed, however I prefer to be verbose in my explanations, that way someone with less experience managing disks from the command line can still follow this procedure. – Alison E.E. Jul 3 '17 at 20:33

You must log in to answer this question.

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