0

My cousin contacted me for tech support because her computer was refusing to boot to the startup drive, and the issue turned out to be a corrupted drive that Disk Utility refused to fix, telling us to format the drive. I looked for a way to back up her files and found this answer, which says that you can use Recovery HD's Terminal's cp command.

Her computer is currently running cp -pRv "/Volumes/Macintosh HD/" "/Volumes/EHD" and it seems to be working, copying every file on her computer to her external drive. Since it's not Time Machine, though, putting everything back in its place is going to be a hassle. I was wondering, once we format the drive, could we just use cp again? How much of the setup process would that get done for us?

To clarify, could we, for example, not even bother reinstalling OS X or anything, just run cp -pRv "/Volumes/EHD/" "/Volumes/Macintosh HD"? Would that restore everything and make it functional?

3
  • 4
    No, OS X needs to be properly installed and the cp command is not a proper way to do it. I'd just get the contents of her Home folder and not worry about anything else. Then fix the hard drive and reinstall OS X, then copy back only the User Data, basically starting fresh but with the important User Data files intact. May 2, 2016 at 1:54
  • @user3439894 There are at least 3 user accounts and possibly some third-party apps (Microsoft Office, if nothing else). Is there any convenient way to deal with all of those?
    – user24601
    May 2, 2016 at 4:39
  • 2
    The convenient way would have been 'have a backup, preferably on Time Machine'.
    – Tetsujin
    May 2, 2016 at 8:50

2 Answers 2

1

Yes, you could just copy it back, but it may not be bootable. That can be fixed by installing OS X over the top of your files. It should preserve what is there and make it bootable.

0

The problem you encounter was exactly the same as mine. You can use the dd command. It does a sector by sector clone from your hard disk to another hard disk. Unlike Disk Utility, it doesn't throw you any error.

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. I shared the details and other recovery methods here.

3
  • 1
    This can cause problems if the two disks are not exactly the same size. If the source is larger, some data will not be copied; if the destination is larger, some of its space will be unallocated and hard to recover. asr is a much better way to clone volumes under macOS. Mar 12, 2017 at 13:49
  • @GordonDavisson thanks for pointing that out. While I was researching for ways, I came across asr too. Could you share how to use the asr to backup?
    – Scott
    Mar 12, 2017 at 13:53
  • asr can be a little tricky depending on the situation, but in general you'd use it something like sudo asr restore --source "/Volumes/Macintosh HD/" --target "/Volumes/EHD" --erase. In the case of a corrupted drive (as in the original question), it may either fail or copy too accurately (i.e. it'd copy the corruption along with everything else), so now that I think about it rsync (see here) would be a better bet. BTW, that also applied to dd -- it will copy the corrupt volume structures rather than fixing them. Mar 13, 2017 at 1:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .