help -- copy to external via terminal?

Discussion in 'OS X' started by ziggyonice, Apr 3, 2008.

  1. macrumors 68020


    Mar 12, 2006
    Rural America
    The situation is this: I have a MacBook Pro, first generation. The internal hard drive has been damaged, and cannot boot the operating system (Mac OS X 10.5.2). Unfortunately, my last backup was not very recent, and I'm trying not to lose these files.

    So my goal is to gain access to the hard drive, and copy everything on it to an external hard drive.

    Note that the Firewire port on the machine is not working. Thus, any file transferring must be accomplished over USB or Ethernet. I also have access another Mac, if that would be of any assistance. Now let me throw you some ideas here. (For the record, I don't know if any of this will help, but it's worth a try.) I have booted the machine off the Leopard Install Disc. This now gives you access to several options:

    Startup Disk. Disk Utility. Terminal. System Profiler. Network Profiler.

    Something tells me Terminal might be able to make some magic happen. Unfortunately, I know nothing about the voodoo commands that can be issued in it to get this plan into action. I hear rumors about something called Single User Mode, however I know very little about it (other than, if entering the wrong command, erasing your drive).

    So if anyone out there has any suggestion as to how to set this up, I'd appreciate it. Thanks.
  2. macrumors 68030

    Oct 31, 2006
  3. macrumors regular

    Mar 28, 2008
    I'm not 100% sure this will work... But here's some information that might get you started:

    Disk drives are found in /Volumes. So an external HDD called "HDD" will be found in /Volumes/HDD (capitals matter in UNIX!)

    So you might go about doing something like this...

    sudo cp /Volumes/"Macintosh HD" /Volumes/HDD[/quote]
    That, in theory, should copy everything from your Macintosh HD folder/disk/directory (w/e you want to call it) and put it directly on your external HDD.  I've never tried doing a whole disk backup with the terminal before, so I'm not sure how well it's going to work.
    Something else you can do:
    Use Disk Utility to make a disk image of your HDD.
    1. Open up Disk Utility
    2. Click your internal HDD on the left side bar
    3. Click "New Image" on the top
    4. Choose the location of your external HDD as the directory in which to save
    5. Choose read/write for the Image Format (trust me on this, you don't want to do read-only)
    6. Hit "Save," and it should do its magic.
  4. macrumors 68000

    Feb 23, 2006
    Don't bother copying system stuff over. Save your home directory before any more damage occurs to the disk.

    cp -pr /Volumes/<name of your hard drive>/<your username> /Volumes/<backup drive>
    You can press the Tab key for name completion.
  5. macrumors newbie

    Dec 4, 2012
    This. I had a similar problem, and it is the easiest and simplest solution out there - if you give a dawn about the system files.
  6. macrumors 6502a

    Sep 10, 2012
    RE: dd, ditto, ddrescue, ...

    Hi ziggyonice,

    You might want to look into the Terminal "ditto", "dd", and "ddrescue" commands as possible substitutions for the "cp" command. The reasons being that "cp" will terminate when a file cannot be read while "ditto" will report the error to stderr and do its best to continue. (Yes, I know about the -R switch on cp, as in "cp -R", but in my limited experience ditto does a better job than cp.)

    The "dd", or 'digital dump' or 'convert and copy' except that "cc" was already taken so "dd" was used instead, commands perform a lower level block copy of files/partitions/volumes, and thus may be used to recover corrupted files that cannot be recovered by other means. Why, "dd" can even be used to copy the boot sector of a hard drive and thus can be used to repair the MBR (Master Boot Record) on a Windows/Linux boot drive.

    Another choice might be the "ddrescue" command which tries hard to rescue data when read errors are encountered. Personally, I use the "ddrescue" utility built from MacPorts on the Mac OS (Linuxes have their own versions). Speaking of which, I would also try to use a Linux to mount the damaged drive and then attempt the recovery using the Linux commands.

    ...just three other command possibilities to help in your attempt to recover your files from your corrupted hard drive...

    Good luck,

Share This Page