Created
August 14, 2011 23:27
-
-
Save necolas/1145450 to your computer and use it in GitHub Desktop.
Maintain a bootable clone of Mac OS X volume
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PROG=$0 | |
RSYNC="/usr/bin/rsync" | |
SRC="/" | |
DST="/Volumes/Backup/" | |
# rsync options | |
# -v increase verbosity | |
# -a turns on archive mode (recursive copy + retain attributes) | |
# -x don't cross device boundaries (ignore mounted volumes) | |
# -E preserve executability | |
# -S handle spare files efficiently | |
# --delete delete deletes any files that have been deleted locally | |
# --exclude-from reference a list of files to exclude | |
if [ ! -r "$SRC" ]; then | |
/usr/bin/logger -t $PROG "Source $SRC not readable - Cannot start the sync process" | |
exit; | |
fi | |
if [ ! -w "$DST" ]; then | |
/usr/bin/logger -t $PROG "Destination $DST not writeable - Cannot start the sync process" | |
exit; | |
fi | |
/usr/bin/logger -t $PROG "Start rsync" | |
sudo $RSYNC -vaxE -S --delete --exclude-from=$HOME/rsync_excludes.txt "$SRC" "$DST" | |
/usr/bin/logger -t $PROG "End rsync" | |
# make the backup bootable | |
sudo bless -folder "$DST"/System/Library/CoreServices | |
exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.Spotlight-*/ | |
.Trashes | |
/tmp/* | |
/Network/* | |
/cores/* | |
/afs/* | |
/automount/* | |
/private/tmp/* | |
/private/var/run/* | |
/private/var/spool/postfix/* | |
/private/var/vm/* | |
/Previous Systems.localized | |
/Volumes/* | |
*/.Trash |
Only just seen your comment (I wish GitHub emailed you about comments on gists). Thanks for this. Looks like you have some good improvements that I'll look to roll into my script, now in this dotfiles repo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A more comprehensive list of files to exclude is available on the CCC website, which I included in my fork. This also explains why this backup does not boot (as noted on your website)