BraveNewCliche

Q: Copying Files to External Hard Drive via Terminal?

Hey guys!

 

So before I begin, I have a Mid 2011 Macbook Pro 15 inch, 16gb of RAM, and Yosemite 10.10.2 installed on my system.

 

I think my Macbook Pro's hardrive is giving up the ghost. Anytime I try to boot it up, it the loading bar fills to about the 1/4 mark and then the computer completely shuts down. I tried repairing the disk in recovery mode, but I get an error that simply states that the hardrive cannot be repaired and that I should back up as many files as I can. I even attempted to use the /fsck/ command in Single User mode to repair my disk, but it just gave me a disk I/O error. All of my research on the problem has pretty much lead to the conclusion that my hard drive is on it's last legs.

 

Because I am an absolute idiot, I have never activated Time Machine, and therefor, I have no backup of any of my files, and I don't see anyway to create a backup in recovery mode. That being said, I see that I can access Terminal from Recovery mode. Is there any way to use Terminal to back up my files to an external drive? Or am I completely screwed?

MacBook Pro, OS X Yosemite (10.10.2), 15 inch, Early 2011

Posted on Feb 14, 2015 10:54 PM

Close

Q: Copying Files to External Hard Drive via Terminal?

  • All replies
  • Helpful answers

  • by Niel,

    Niel Niel Feb 14, 2015 10:56 PM in response to BraveNewCliche
    Level 10 (311,446 points)
    Feb 14, 2015 10:56 PM in response to BraveNewCliche

    You may be able to use the cp or ditto commands to copy the files off; run ‘man cp’ or ‘man ditto’ for information about using them.

     

    (122377)

  • by BraveNewCliche,

    BraveNewCliche BraveNewCliche Feb 14, 2015 11:11 PM in response to Niel
    Level 1 (0 points)
    Feb 14, 2015 11:11 PM in response to Niel

    Hmm, I can't seem to use the "man x"  command. anytime I try I just get the message "Warning: cannot open configuration file /private/etc/man.conf   No manual entry for ditto/cp"

     

    Are there any restrictions for what terminal can or can't do in recovery mode?

  • by Eric Root,

    Eric Root Eric Root Feb 15, 2015 1:46 PM in response to BraveNewCliche
    Level 9 (69,536 points)
    iTunes
    Feb 15, 2015 1:46 PM in response to BraveNewCliche

    If you can see the partition, you can use Disk Utility/Restore to copy the data to an external. Note it reformats the external, so any data on it will be lost.

  • by Niel,

    Niel Niel Feb 15, 2015 1:48 PM in response to BraveNewCliche
    Level 10 (311,446 points)
    Feb 15, 2015 1:48 PM in response to BraveNewCliche

    Click here and here for the pages.

     

    (122397)

  • by John Lockwood,

    John Lockwood John Lockwood Feb 16, 2015 4:37 AM in response to BraveNewCliche
    Level 6 (9,165 points)
    Servers Enterprise
    Feb 16, 2015 4:37 AM in response to BraveNewCliche

    You can in theory boot to a Recovery partition or the Internet Recovery software, from that you can then in theory use Terminal to copy files to an external drive. Roughly the command would be

     

    ditto /path/to/source /Volumes/path/to/destination

     

    As a tip if you are copying a folder and you want ditto to make the same folder on the destination you need to include the folder name in the destination path, e.g.

     

    ditto /Users/myuser/Documents/myfolder /Volumes/Backup/myfolder

     

    Before however you get stuck in to trying the above you might want to consider trying DiskWarrior. I don't believe it will necessarily be able to repair the damage any better than Disk Utility aka. fsck because it sounds like the hard disk has developed a hardware problem, but Disk Warrior can sometimes 'mount' a virtual copy of the hard disk and let you copy files from this virtual copy. I have myself managed to recover the vast majority of a hard disk this way.

     

    To do this you would need to boot from a different drive, install Disk Warrior on it, run it to try and access the failing drive and then you should be able to try using the Finder to copy files from the virtual copy of the drive.