Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

macstatic

macrumors 68020
Original poster
Oct 21, 2005
2,025
165
Norway
I've been told the "dd" terminal command is ideal for cloning an entire hard drive regardless of what's on it, so it seems this would be ideal for transferring both Mac and Bootcamp partitons over to a new (larger) drive.

It does however look a little intimidating to use (and easy to make a fatal mistake), so is there a GUI shell of some sort that can be used with it? Also, is it correct that it first creates a disk image of the drive before copying over?
I ask because I'm in the process of replacing my 1TB SSD in a Macbook Pro wih a 2TB SSD, and want to transfer everything over including Bootcamp.
As I've read you shouldn't copy a drive that's actually in use I've prepared a USB flash drive with MacOS 10.9 Mavericks which I'll boot from, then allowing me to copy from the Macbook's internal (1TB) SSD to the new external (2TB) SSD attached to its USB 3 port.
 
I've been told the "dd" terminal command is ideal for cloning an entire hard drive regardless of what's on it
Yes, it is. But in case of you use Linux then you will need to fix grub loader: it is like because of drive serial number changes and loader needs to be updated.

it seems this would be ideal for transferring both Mac and Bootcamp partitons over to a new (larger) drive.
Yes, it would. I did it that way for many times. It is quite smooth process: when you has OSX and Windows partitions you seem not to need do any extra workarounds.
is there a GUI shell of some sort that can be used with it?
`dd` is old IBM command and is like designed for Terminal
is it correct that it first creates a disk image of the drive before copying over?
Yes, it is. But `dd` clones source to destination: it doesn't matter if these ones are disks or images - it almost makes no difference between a disk and an image file.
 
Yes, it is. But in case of you use Linux then you will need to fix grub loader: it is like because of drive serial number changes and loader needs to be updated.
I just want to use it on my Mac (10.13.6).
I see the command is already there (if I just enter "dd" in the Terminal nothing happens, but "man dd" responds with the man page for it).

macstatic said:
it seems this would be ideal for transferring both Mac and Bootcamp partitons over to a new (larger) drive.
Yes, it would. I did it that way for many times. It is quite smooth process: when you has OSX and Windows partitions you seem not to need do any extra workarounds.
Excellent! I would like to give it a go before needing to buy Winclone or some other commercial app.

Assuming I boot my Mac from a USB flash drive with MacOS on it (and then run the Terminal from it), what is the exact syntax and command(s) for cloning the internal drive over to an external USB attached drive?
Let's call the internal drive original_SSD and the external, empty USB-attached drive empty_SSD.

Do I need to prepare the new drive in some way? Partition it for the Mac and Windows partitions, or does "dd" simply make an exact copy of the entire drive anyway? Does it also check that the copy is OK?

And does it make a disk image of the Windows (Bootcamp) partition before copying it over (like "Winclone" does), or does it just read from the source drive and write to the destination drive? (i.e. no need to have double the Bootcamp partition size free in order to make a clone).

If this proves to be working fine I guess I could create a script for making further clone backups without worrying about the correct syntax etc. I worry that I may overwrite the original drive etc. :oops:
 
Is the first one the original drive (the one to copy from)?
Like this:

dd if=/original_SSD/from of=/empty_SSD/to
 
does "dd" simply make an exact copy of the entire drive anyway? Does it also check that the copy is OK?
1. Yes, dd does exact copy of a drive - if you properly command for it (because of you may copy all entire physical disk or a logic drive only).
2. If you want to check copy done with something like rsync then it gonna be a more complicated (probably, for better user experience for it Clonezzilla looks better). Though `dd` outputs errors happened but in some cases you might ignore them.

P.S. I cloned Mac disks with `dd`. I didn't see errors for them and data was never corrupted in my cases. Yet one thing more if destination drive is bigger (APFS in my cases) then you will need to fix empty space (it is a little tricky).
 
Yes, I want to copy the entire physical disk, which I understand is needed if I want to include the Bootcamp partition as well.
I tried Clonezilla, but couldn't get it to work.

What do you mean by needing to fix empty spaces if the destination drive is bigger than the source drive? So it's not just a matter of issuing this command in order to clone a drive?

dd if=/original_SSD/from of=/empty_SSD/to

As far as I've read the destination drive has to be the same size or bigger than the source drive. And I suppose it doesn't make any difference if the source drive is 20% or 95% full as it just copies each sector bit by bit, right?
 
What do you mean by needing to fix empty spaces if the destination drive is bigger than the source drive?
They meant that you basically need to expand the copied partition to have it also include that extra empty space on the bigger drive.

You really should try to learn from `man dd`, and go through the process of then websearching your questions, to properly learn how to use dd before you actually rely on it. If you accidentally (or by bad advice) flip something around you might find yourself having deleted rather than copying your data.
 
  • Like
Reactions: vitalz and mick2
dd if=/original_SSD/from of=/empty_SSD/to
That's not quite right.

dd if=source of=destination

'if' means 'input file', and 'of' is 'output file'. The source and destinations are the device names (more on this below). You don't want /from and /to on the end.

To get the device names, run "diskutil list". This will show each drive in the system, along with a name like /dev/disk0. You might want to use rdisk (raw disk) instead of disk, as this is faster.

To copy from disk0 to disk2:

dd if=/dev/rdisk0 of=/dev/rdisk2

This is a bit of a summary and is probably most unclear :)

Edit: I should've clicked the link above; it explains the same stuff and has some example output.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.