1

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?

1
  • 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. Commented Jul 28, 2018 at 10:11

2 Answers 2

3

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

1
  • What if you use dd within mac os to make a backup of the running system? Is this possible? Or would this cause corruption? I suppose it is saver to do this from a live cd. Commented Nov 26, 2020 at 10:33
0
  1. Recovery of a valid binary copy of an entire HDD shell succeed. But beware, it's not really possible to prepare a working backup from a running system - you need to backup using single user mode or a recovery disk. RW mounted partition is a "living" system and probability its content changes during the dd run is almost 100 %.

  2. So called recovery disk is a hidden partition placed somewhere near the end of the disk. If you run dd and recover from a full disk backup, it gets overwritten too. The only thing outside of HDD is NVRAM (with info such which was the default bootable device etc.).

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.