Timemaschine will not Backup my USB-Stick. So i found some Tipps with rsync.
The solution:
rsync with --link-dest=../Latest makes a fast copy and only creates Hardlinks of existing files. I had some problems with --link-dest as relative path is not relative to your pwd but relative to the rsync dest-path !!
What's cool with this solution ?
As all the same files are Hardlinks there is very little real space needed on the Backup-File. Each physical file is only stored once. The folders of Backup-Date and the Latest show you the complete Backup with all "real" Files, you can even Start Apps from the backup if you really want, but its better not to modify the backup-files. This means you can copy Folders or the Complete Volume to your destination and have it in correct order, also by copying with "rsync -a" user rights (chown, chmod) should still be correct.
Hardlinks have an internal Ref-Counter and know how many Hard-Links point to the Real File. If The Original File is Deleted then the Hardlink is moved to the File and only the Reference to the File is removed. This means you can savely delete one of the Backup-Date Folders and your Backup still works perfectly. Which means if you want to clean up a Bit you simply remove a Date-Folder and loose some Versions in between, but as long as you keep at least one Backup-Date-Folder you have a complete and Working Backup.
It uses a similar and File-Structure like TimeMaschine, can be optimized to be identical. (Date + Folder are reversed in path).
Usage:
* Download the tm_backup.zip Attached here.
* Extract it and put the folder on your Backup (External USB)-Drive. You can rename the Folder if you want, as the paths in the script are all relative.
* cd into the Folder with terminal
* run following command to do a backup of one of your "/Volume/MYVOLUME" Drives.
"./tm_backup.sh /Volumes MYVOLUME"
* Be careful with spaces in Foldernames so better Quote them or use "\ " Backslash escapes.
* It might help if you uncheck the "Ignore Ownership of the Volume" in Get-Info of your Flash-Drive. (as rsync might get confused and not detect it correctly as not modified).
You can also add this backup-script into a cronjob ("crontab -e") as its fully automatic.
the tm_backup.sh need to have "chmod +x tm_backup.sh" , maybe you have to call the script as sudo, as it need to able to read all files and also copies system files if they are not excluded in rsync.excludes file.
if [[ ! $1 ]]; then echo "USAGE $0 PATH DIR; e.g. sudo $0 /Volumes Extra32GB
date_final=`date "+%Y-%m-%d-%H%M%S"`
date="$date_final.progress"
BASE=$1
VOL=$2
if [[ ! -d $BASE/$VOL ]]; then echo " src not found, exit!"; exit; fi
echo "--- Making Backup of $BASE $VOL ---"
mkdir -p $VOL
echo "rsync -aP $BASE/$VOL/* $VOL/$date/"
sudo rsync -avP --delete --link-dest=../Latest --exclude-from=rsync.exclude $
cd $VOL
# move .progress to final
mv $date $date_final
# remove symlink to old Latest
rm -r Latest
# point symling to new Latest (current Backuped with date)
ln -s $date_final Latest
Diese Webseite wurde mit Jimdo erstellt! Jetzt kostenlos registrieren auf https://de.jimdo.com