Backing up to an external hard drive using terminal commands

Is there any terminal command that allows me to copy all my files to an external hard drive. My OSX upgrade failed, so I need to back up my files somehow, ASAP!

+3


source to share


3 answers


I would go with rsync

, as it only copies files changed since the last run, which makes the second and subsequent backups faster.

Assuming your username Freddy Frog

and your external HDD is called My External Drive

, you can do this:



rsync -av "/Users/Freddy Frog" "/Volumes/My External Drive"

      

+6


source


cp -R / Path to folder / Path to external HDD

This is to copy the folder from the "Folder Path" folder to the external hard drive

If you want to do it as a repeating command, follow these steps:

  • Open a text editor and write:


http://pastebin.com/fNuCMMr4

  • Save it as Backup.plist
  • Now go to / Library / LaunchDaemons and put the file in the folder
  • Restart your computer.

Every day at 15:00 the / Path -to-folder will be copied to the external hard drive (if Mac is running at this time)

And yes of course you need to change the code I gave you for the .plist file

+2


source


backup to a single (optionally compressed) disk image file that can be restored using Apples Disk Utility with hdiutil

sudo hdiutil create dst_image.dmg -format UDZO -nocrossdev -srcdir src_directory

      

OSXDaily also provided examples in 2009: for ditto , rsync and asr

sudo ditto -X src_directory dst_directory

sudo rsync -xrlptgoEv --progress --delete src_directory dst_directory

sudo asr -source src_directory -target dst_directory -erase -noprompt

      

+1


source







All Articles