0

I have a clone of an entire Mac OS HDD that I created using dd, as:

sudo dd if=/dev/sda of=/media/mint/backup/mac-backup.img

I verified the integrity of the image at creation time using diff. Now I have the machine back in my hands and I'd like to restore the backup. Can I simply do:

sudo dd if=/media/mint/backup/mac-backup.img of=/dev/sda

Or will this fail? I have an older backup made using a different process that I know I can restore from during the normal Mac setup process, so if this isn't going to work I can do that instead. However I don't know if that setup utility lives on the HDD or if it's in a more permanent storage location (the MB for example), so I am worried that I might accidentally overwrite it with dd. If that happens I don't know how to get a new copy.

Am I about to paint myself into a corner?

  • The important thing is to avoid to accidentally overwrite important data. If you keep the data away (or have a backup, that is not connected), you are safe. But if the backup image is the only one, you must have it connected, and then you must make sure that you will not overwrite the drive, where it is stored. You can use dd, but if you use a tool with a final checkpoint and some help output, you can double-check, that you will be restoring to the correct device before lauching the restore process. For example, if you boot from a live linux drive, you can use Disks alias gnome-disks. – sudodus Jul 28 '18 at 10:11
1

Short answer: yes this works fine.

Longer answer: I used dd to restore the data as above, and it was successful. However, the Mac wouldn't load the OS upon power-on. Picking the HDD from the startup device menu allowed it to boot fine and all of the data was there. I loaded the Mac into recovery mode and ran first aid on the disk, and after doing this it loads he OS without any trouble upon power-on.

So for anyone else doing this in the future, 'dd' is a perfectly valid backup and restore method to use for a Mac OS HDD. Here's a little bit of further advice related to dd for anyone who might be about to do this:

  • You can pipe the dd through gzip if you want to make a compressed backup, as:

dd if=/dev/sdX | gzip - c > /back/up/file.img.gz

gunzip -c /back/up/file.img.gz | dd of=/dev/sdX

  • You can use the noerror and sync options with if you think your disk might generate read errors to be able to keep going, though be aware of your block size (set with bs=64K or whatever size you want) because an error anywhere in a block will mess up the entire block

  • Related to above, smaller blocks are safer when used with conv=noerror,sync, but are slower. If you think read errors are unlikely you may want to increase the block size

  • The option status=progress let's you keep an eye on how things are progressing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.