Can the cp command be used to restore a hard drive

backuphard driveinstallrecoveryterminal

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?

Best Answer

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.