7 Replies Latest reply: Jul 22, 2009 6:06 PM by KJK555
iMasterWeb Level 1 Level 1
Hi! I am currently unable to access my Mac, you can read more at my post here: http://discussions.apple.com/thread.jspa?threadID=2088472&tstart=30&messageID=98 59640#9859640

For that reason, the only applications I have are those available when booting from the installation disk, which includes Terminal. I also just bought a Western Digital My Book. I was wondering if there was any way to copy the contents of my Hard drive to my external hard drive using a Terminal command. There seems like there should be and any help would be appreciated. Thanks!


iMac 20", Mac OS X (10.5.7), The Better 20" 2.66 GHz Intel Core 2 Duo
  • baltwo Level 9 Level 9
    Yes, use diskutil the underlying command structure that Disk Utility is build on.
  • iMasterWeb Level 1 Level 1
    I know nothing about Terminal so what would the actual command be? I didn't see a "copy" option.
  • KJK555 Level 4 Level 4
    Sure, piece of cake...
    you can use asr, rsync or ditto.

    asr copies everything. It's actually designed to make clones.
    asr restore --source source --target target [options]
    asr restore --source "/Volumes/Leopard" --target "/Volumes/Data2" --verbose
    (options probably not needed, --verbose is good though if your bored and want to
    watch some text fly by.

    rsync is a backup program
    Local: rsync [OPTION...] SRC... [DEST]
    rsync -av "/Volumes/Leopard/" "/Volumes/Data2"
    note the trailing "/" after Leopard. Be sure to include
    at the end of the source path so rsync won't add an extra directory
    to your backup. rsync has a lot of options, -av will do a regular archive.

    ditto is a copy program.
    Not quite as fast as asr and rsync, but very simple.
    ditto [-v] [-V] [-X] [<options>] src ... dst_directory
    ditto -v "/Volumes/Leopard/" "/Volumes/Data2"

    That's it, choose one and let your fingers do the walking.

  • baltwo Level 9 Level 9
    Thanks for jumping in. For the OP, it's really ASR which does the restoration in Disk Utility. Sorry for not mentioning that. KJR555 has provided the steps.
  • iMasterWeb Level 1 Level 1
    I'm having some trouble....

    ditto reports these messages:

    ditto: /./dev/fd/3: Not a directory
    ditto: /./dev/fd/4: Not a directory
    ditto: /./dev/fd/5: Not a directory

    asr reports (I don't know the exact wording):

    Failed to copy blessed files which may have out-of-date files. (or something like that)

    rsync just didn't work...
  • KJK555 Level 4 Level 4
    ditto only copies directories or files from mounted drives. It will not accept a "/dev/diskxxx"
    argument as the source or destination. You can copy root directory to root directory though
    as shown in my example:
    ditto -v /Volumes/Leopard /Volumes/Data2
    (copies everything from root directory of volume "leopard" to root directory of volume "Data2")

    rsync operates basically the same way. It needs valid file paths on the source and destination also.

    asr will accept source and target /dev entries or volume mountpoints.

    If you are having problems figuring out /dev entries or Volume mountpoints use;
    "diskutil list" command at the command line to see info on all mounted volumes.
    the NAME column is the mountpoint always preceded by /Volumes.
    example: if name is Mac Data then the path to root is /Volumes/"Mac Data"
    note: if name contains spaces, then it must be quoted.

    The last column is IDENTIFIER. That determines the dev entry.
    example: if Mac Data's identifier is "disk3s2", then its dev entry is /dev/disk3s2.

  • KJK555 Level 4 Level 4
    For a quick "command line 101" see this thread: