OSX create a HDD clone

2

1

Is there a way to create an HDD clone with unix tools alone? I'm not interested in using Carbon Copy Cloner or Super Duper or tools like that. I'd like to be able to run a simple command and have the clone appear on my external drive.

I tried doing this with the tar command and sudo but it fails every time without giving me much in the way of why it failed.

Any ideas? Anyone done this before?

Honza Pokorny

Posted 2013-07-12T14:09:39.560

Reputation: 263

Just note that dd is going to take a long time to clone your drive since it does it bit for bit. I hope this is just a one off deal, because using dd for the long term isn't a sustainable approach. – skub – 2013-07-13T00:58:20.017

Answers

4

You could also use dd with something like:

sudo dd if=/dev/disk1 of=/dev/disk2 bs=128m

Where /dev/disk1 is the disk you want copied & /dev/disk2 is the target.

And if you need to find the name of your disk, you can use diskutil list.

Tristan

Posted 2013-07-12T14:09:39.560

Reputation: 41

4

There are lots of ways to do it:

  1. Use dd as in the first post.
  2. Use rsync as in the second post.
  3. Use ditto as included in this post.
  4. asr

For rsync you need to download the latest version because the one supplied with OS X won't preserve resource forks but the new one will. CCC uses rsync. Phoenix uses ditto. CCC may also make command line calls to asr when it does block by block cloning. asr (stands for Apple System Restore) used to be flexible but Apple made it inflexible since about Leopard. ditto's command line usage takes some getting used to.

I would suspect all the "cloning" tools are really sophisticated "script runners," meaning what they're doing could probably all be done in a script and the writers are probably exec'ing calls to the command line tools and letting them do their thing. Speculation on my part but I suspect it's true.

Phoenix's primary job is not to be a cloning tool, it's really making an emergency boot drive by extracting the core OS from a working volume. I'm guessing the writers just thought they would throw simple cloning in there because it was easy.

I've used every single tool mentioned in this thread, including the dd method, and for once I can happily report that they all work.

Here are some links for interested users:

ElTorosDog

Posted 2013-07-12T14:09:39.560

Reputation: 61

1

You can do this with Rsync. This blog article should get you heading in the right direction.

Basically it's rsync with a bless at the end to make things bootable, seen in one of the last lines of his script:

sudo bless -folder "$DST"/System/Library/CoreServices

BsdHelper

Posted 2013-07-12T14:09:39.560

Reputation: 11