4 Replies Latest reply: Sep 1, 2011 11:25 AM by Barry Lee Reynolds
Barry Lee Reynolds Level 2 Level 2 (430 points)

So if I have two partitions on one hard drive can I combine them without losing the data that is on one of them?  If not, could I just do a time machine backup, combine the two partitions, and then restore the time machine backup?  Would that work?


Mac mini, Mac OS X (10.6.7), Mac OS X Server; 2.66GHz; 8GB; 1TB
  • twtwtw Level 5 Level 5 (4,900 points)

    Diskutil has a mergePartitions command.  It has caveats: only partitions that are sequential on disk can be merged, and only the data from the first partitions will be preserved, and only if it's a partitions formatted as journaled HFS+.  in terminal, you would type:

     

    diskutil mergePartitions firstPartition lastPartition

     

    where first and last partitions can be specified bu mount points, disk identifiers, UUIDs, or device paths.  see man diskutil for details.

     

    Be careful.  the command diskutil mergePartitions disk1s1 disk1s3 will merge partition 1, 2 and 3, not just 1 and 3.  This is particularly tricky if you use mount points: diskutil mergePartitions /volumes/gumby /volumes/foxtrot may erase other partitions accidentally or may do nothing at all if you are not sure of the partition order on disk.  Run the command diskutil list in terminal to make sure you have your specifiers and formats correct before you try merging.

  • Barry Lee Reynolds Level 2 Level 2 (430 points)

    Thank you for the answer.  Unfortunately, I've got my data on the wrong partition.  Could I just backup to time machine, restart with my install disk, repartition the HD, format, and do a restore from time machine. 

  • twtwtw Level 5 Level 5 (4,900 points)

    It sounds like a reasonable plan, but I've never used time machine for that purpose so I can't say for certain.  The only sticking point would be if time machine keeps track of the UUID of the disk it's backing up - when you repartition the drives the UUIDs will change, which might interfere with the restore. That doesn't strike me as likely, mind you, but I'd want to be sure I could recover the data before I tried it. Maybe someone else can say.

  • Barry Lee Reynolds Level 2 Level 2 (430 points)

    I just read some up on time machine and it seems you can either restore data from the same mac or from another mac.  If you do it for the same mac, you simply do a restore.  From another mac it will just import everything over from a fresh install.  I think I will give it a shot and see what happens.

     

    I got myself into this mess for nothing having enough hard drive space.  I was not using the server software so I wanted to install regular SL on one of the HDs but the other hard drive was filled with ripped DVD content, so I decided to partition and install SL and then I could delete the server portion.  I did not know (stupidly) that I could not recombine them without losing the data.  I ordered a 3TB drive that will arrive here tomorrow (hopefully) and I will get all that straightened out.  I'll post what happens.  Either way, I will do a time machine backup as well as another backup of my itunes, iphoto, and two media database programs I use.  The other stuff I have on the computer is easily replaced.  Documents are all saved in Dropbox anyway.