7 Replies Latest reply: Jul 22, 2009 6:06 PM by KJK555
iMasterWeb Level 1 Level 1 (50 points)
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!

-iMaster

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

    asr copies everything. It's actually designed to make clones.
    SYNOPSIS
    asr restore --source source --target target [options]
    example:
    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
    SYNOPSIS
    Local: rsync [OPTION...] SRC... [DEST]
    example:
    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
    example:
    ditto -v "/Volumes/Leopard/" "/Volumes/Data2"

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

    Kj
  • baltwo Level 9 Level 9 (61,830 points)
    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 (50 points)
    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 (2,895 points)
    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.

    Kj
  • KJK555 Level 4 Level 4 (2,895 points)
    For a quick "command line 101" see this thread:
    http://discussions.apple.com/thread.jspa?messageID=9759840&#9759840

    Kj