Backup to external HDD with terminal commands
I would go with rsync
as it only copies files changed since the last time you ran it, making it quicker on second and subsequent backups.
Assuming your username is Freddy Frog
and your external HDD is called My External Drive
, you could do this:
rsync -av "/Users/Freddy Frog" "/Volumes/My External Drive"
cp -R /Path-to-folder /Path-to-external-HDD
This wil copy the folder from (Path-to-folder) to the external HDD
If you want to make this an recurring command, the are a few steps to be made:
- Open texteditor and write:
- Save it as Backup.plist
- Now navigate to /Library/LaunchDaemons and place the file in the folder
- Restart your machine
Every day at 15:00 the folder of /Path-to-folder will be copied to the external HDD (if the mac is running at that time)
And yes, ofcourse you need to modify the code I gave you for the .plist file
backup to a single (optionally compressed) disk image file that can be restored using Appleās Disk Utility software with hdiutil
sudo hdiutil create dst_image.dmg -format UDZO -nocrossdev -srcdir src_directory
OSXDaily also provided examples in 2009: for ditto, rsync, & asr
sudo ditto -X src_directory dst_directorysudo rsync -xrlptgoEv --progress --delete src_directory dst_directorysudo asr -source src_directory -target dst_directory -erase -noprompt