5 Ways to Backup Your Mac That Won’t Boot in Recovery Mode

mac os boot screen
Credit: via Gadget Hacks

Ever experienced a hard disk failure and then to realised you have not backed up a single file since forever?

Recently, one of my team member’s iMac crashed. It was shut down but was never able to boot up ever since. Turn on the Mac, the Apple logo flashes and the progress bar moves. And boom, it shuts down automatically.

Enter Recovery Mode

Boot up your Mac and press CTRL + R before the Apple logo to enter recovery mode.

mac os sierra recovery mode utilities
Credit: Apple Support

My first move is do a quick fix to the hard disk. I launched Disk Utility in Recovery Mode and did a disk repair. But disk repair could not be completed. In the midst of the process, it displayed a message citing an input/output error.

Backup options in Recovery Mode

Now, we are talking about backing up your hard drive in recovery mode. Time machine is out of the question here.

TLDR; I eventually went with backing up the files via the cp command – a simple copy and paste available in all UNIX based machines. It worked perfectly! I first used use the dd command – a sector by sector backup tool, but the files inside the recovered hard disk were seemingly damaged. Target Disk Mode was not available and Disk Utility failed for me.

1. Target Disk Mode

This is probably the easiest method. Target Disk Mode lets you access and backup your files from another Mac, as if there are on an external hard disk. However, you would need a Thunderbolt 2/FireWire cable and another Mac.

Simply connect your two machines via the cable, restart your non-working Mac and boot it up in Target Disk Mode by pressing on the T key.

In my case, we didn’t have the cable, so this option was out.

2. Disk Utility

The idea here is to create an image of my Mac using Disk Utility and save it on my external hard disk.

For me, after running the imaging process started for a few minutes, about 10%, it stopped. Disk Utility displayed a message, “Unable to create Macintosh HD.dmg. (Input/output error)”.

3. DD UNIX Command

After much research on the web, I came across a third option – the dd command tool. Compared to Disk Utility, this is a much more ancient tool and is only available via the Terminal.

sudo dd if=/dev/disk0 of=/dev/disk2 bs=128m conv=noerror,sync

This is the command, which I got from AskDifferent, where if=/dev/disk0 refers to the source that dd is cloning from and of/=dev/disk2 is the destination. I don’t know much about setting the right byte sector, so I left it as bs=128m.

In order to know which is your Macintosh HD and which disk is your external hard disk, you would need to get the identifiers via the diskutil tool.

In you existing Terminal session or open a new tab for a new session, enter the command diskutil list and all the drives attached to your Mac will show up in a nicely formatted way.

From the list you can identify which hard disk you will be accessing.

> diskutil list
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *320.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            319.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3       
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk1
   1:                        EFI                         209.7 MB   disk1s1
   2:                  Apple_HFS Backup                  499.8 GB   disk1s2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk2
   1:                        EFI                         209.7 MB   disk2s1
   2:                  Apple_HFS Backup                  499.8 GB   disk2s2

Along the way while I was using dd, there are some other things you may encounter, such as resource busy message, or you might just be wondering what’s the progress of the cloning. I’ve shared them below.

Resource Busy

dd: /dev/disk5: Resource busy

If you encounter resource busy message like this, you may need to unmount your disk. Enter diskutil unmount /dev/disk5 in your terminal.

Checking progress of dd

Here’s how to check if your dd is still running, enter kill -INFO $PID, or simply press CTRL + T

Keep your Mac awake with caffeinate

This prevents your Mac to sleep, while you recover your hard disk. Strangely, this command didn’t work for me. The iMac still sleeps, or at least the display is still being turned off from time to time.

  1. Open a new tab in Terminal with CTRL + T
  2. Enter caffeinate &

To disable it, enter killall caffeinate. This command only works with OS X 10.8 Mountain Lion and above.

4. ddrescue UNIX Command

While dd runs, I found another tool, ddrescue – which is made for data recovery purposes.

ddrescue /dev/diskA /dev/diskB

Learn how to use ddrescue at Learn UNIX.

Post Backup

After running the dd command for almost 48 hours, the cloning process has finally completed. Happy and excited, I took the backup drive and plug it into a working Mac and I saw this message.

os x can't repair the disk screen shot

Scary. But I didn’t care and proceed to check out the files inside. All was good, every file and folder was cloned. I tried to open one of the image file and I got a “The file could not be opened error…” message.

file could not be open damaged screen shot

That was the end of it. I couldn’t figure what I went wrong. Was it a wrong parameters when I executed the dd command or was it simply bad sectors in the hard disk.

5. cp – UNIX command

After that nasty dd experience, I sought a simpler solution. Just copy and paste!

cp -r -v /Volumes/Macintosh HD/Users/user-name/ /Volumes/Backup

This is the command, where /Volumes/Macintosh HD/Users/user-name is the source and /Volumes/Backup is the destination. The parameter -r means to copy recursively including the files inside each subdirectory. -v is to enable verbose mode, so that I can see all the details while the command is running.

For more other parameter options, head to Tutorials Point.

cp is a life saver

You may notice that I set the source path as my home folder instead of the root folder. I figured that the important files are all inside my Desktop, Downloads, Documents, the rest are already synced to the cloud.

If you’re like me, save yourself time, skip the full backup. My goal was to do a full system backup so that I can quickly restore the Mac back online. In my case, the dd command took 48 hours to clone the entire 1TB worth of data, while backing up the selected files and folders worth 120 GB only took 2 hours.

As it turns out, it was faster to restore my home folder, reinstall the Mac OS and all other apps. It was all complete in about 4 hours.

cp is a life saver.

2 replies on “ 5 Ways to Backup Your Mac That Won’t Boot in Recovery Mode ”
  1. Hey. My MacBook was stuck in an endless panic kernel loop. I backed it up onto an external hard drive using disk utility in recovery mode, so that I can reformat the hard drive to hopefully fix the problem…The hard drive currently has the 166gb file (kind: “disk image”). Is there a way to check to see if it worked beyond that? It’s compressed so I can’t just look at everything. I’m a little nervous deleting everything on my computer without knowing for certain (or with any secondary assurances) that my backup will work…

  2. Hello Scott, I had Mac OS Upgrade to High Sierra fail. Mac will boot into Recovery mode fine. Disk is fine and I feel the OS recovery will work fine. However, before attempting the restore, I want to back up the files in same manner you did. I attempted the same CP command (using my disk specific names) and for some reason the CP ran forever. After 6 days I terminated it. For some reason it seem to be creating copies of all the files into the Library/Containers folders. This seemed to be a recursive process that create files on files on files. The original Containers directory had ball park 150k files, the backup version had roughly 350k files and growing when I CNTL z’d the process. Tried rsync, but it won’t run and unable to run commands in the usr/bin directory either. thus tmutil won’t run, which I read was a nice trick if it did. May try ditto command. But thoughts on what is going on with the CP command? Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *