Diary SiteMap RecentChanges About Contact Calendar

Search:

Matching Pages:

Backup

This got started on 2006-08-03 Backup using rsync. We’re using several external USB harddisks to keep backups. The most important part is that we have two external disks and we keep at least one of them at Claudia’s office. Just making sure that a simple fire in our flat cannot destroy all our data. I do backups using rsync. Note my Restore page.

Look at how the external drives are setup. The Extern disk is always connected and it’s where both I and Claudia keep files such as the iTunes library. That’s why it has the “noowners” flag set. The Backup disk, on the other hand, needs to preserve ownership.

alex@Megabombus:~$ mount
/dev/disk0s2 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
/dev/disk2s3 on /Volumes/Backup (hfs, local, nodev, nosuid, journaled)
/dev/disk1s2 on /Volumes/Extern (hfs, local, nodev, nosuid, journaled, noowners)

I run this from my main machine, Megabombus.

#!/bin/bash

if [ ! -d /Volumes/Backup ]; then
    echo you need to mount the backup drive, first
    exit
fi

if [ -z "$1" -o "$1" == "Megabombus" ]; then
    echo Megabombus
    sudo rsync --archive --delete --delete-excluded \
	--itemize-changes \
	--exclude=.Spotlight-V100 --exclude=.DS_Store \
	--exclude="/Users/*/Library/Caches" \
	--exclude="/Users/*/.Trash" --exclude="/.Trashes" \
	--exclude="/Volumes" --exclude=".fseventsd" \
	--exclude="/Users/*/Library/Application Support/Wuala/Data/Temp" \
	/ /Volumes/Backup/Machines/Megabombus
else
    echo skipping Megabombus
fi

if [ -d /Volumes/Extern -a \( -z "$1" -o "$1" == "Extern" \) ]; then
    echo Extern
    sudo rsync \
	--itemize-changes \
	--partial --archive --delete --delete-excluded --verbose \
	--exclude=.Spotlight-V100 --exclude=.DS_Store \
	--exclude=/Extern/.Trashes --exclude=/Extern/.fseventsd \
	/Volumes/Extern /Volumes/Backup
else
    echo skipping Extern
fi

if [ -z "$1" -o "$1" == "Psithyrus" -o "$1" == "net" ]; then
    echo Psithyrus
    rsync --archive --verbose --compress --delete --delete-excluded \
	--itemize-changes \
	--exclude '/logs' \
	--exclude '/planet/rpg' \
	--exclude 'temp/' \
	--exclude 'pids/' \
	--exclude 'visitors.log' \
	--exclude 'referer/' \
	--exclude '.git/' \
	--iconv=UTF8-MAC,UTF-8 \
	alex@psithyrus.epfarms.org:/home/alex/ \
	/Volumes/Backup/Machines/psithyrus/
else
    echo skipping Psithyrus
fi

if [ -z "$1" -o "$1" == "Emacs Wiki" -o "$1" == "net" ]; then
    echo Emacs Wiki
    rsync --archive --verbose --compress --delete --delete-excluded \
	--itemize-changes \
	--exclude '/org.emacswiki/logs' \
	--exclude '/org.emacswiki/htdocs/*/visitors.log' \
	--exclude '/org.emacswiki/htdocs/*/pids/' \
	--exclude '/org.emacswiki/htdocs/*/temp/' \
	--exclude '/org.emacswiki/htdocs/*/referer' \
	--exclude '/org.emacswiki/htdocs/emacs/git' \
	--iconv=UTF8-MAC,UTF-8 \
	aschroeder@web.moinmo.in:/org/org.emacswiki \
	/Volumes/Backup/Machines/moinmo.in
else
    echo skipping Emacs Wiki
fi

if [ -z "$1" -o "$1" == "Raspberry Pi" -o "$1" == "net" ]; then
    echo Raspberry Pi
    if ping -q -c1 raspberrypi.local > /dev/null; then
      for ME in pi alex; do
        echo ... $ME
	mkdir -p /Volumes/Backup/Machines/raspberrypi.local/home/$ME
	rsync --archive --verbose --compress --delete --delete-excluded \
	    --iconv=UTF8-MAC,UTF-8 \
	    $ME@raspberrypi.local: \
	    /Volumes/Backup/Machines/raspberrypi.local/home/$ME
      done
    else
	notify Raspberry Pi cannot be reached
    fi
else
    echo skipping Raspberry Pi
fi

if [ -z "$1" -o "$1" == "Subterraneobombus" -o "$1" == "net" ]; then
    echo Subterraneobombus
    if ping -q -c1 subterraneobombus.local > /dev/null; then
	rsync --archive --verbose --compress --delete --delete-excluded \
	    --exclude '/tmp' \
	    --exclude '/dev' --exclude '/proc' --exclude '/sys' \
	    --exclude '/home/alex/.local/share/Trash' \
	    --exclude '/home/alex/.mozilla/firefox/*/Cache' \
	    --exclude '/home/alex/Videos' \
	    --iconv=UTF8-MAC,UTF-8 \
	    alex@subterraneobombus.local:/ \
	    /Volumes/Backup/Machines/subterraneobombus.local/
    else
	notify Subterraneobombus cannot be reached
    fi
else
    echo skipping Subterraneobombus
fi

notify Backup finished.

Comments

Gah, with three external disks for me and four external disks for Claudia (one of them dedicated to movie material from her camera), bringing the appropriate two from the office, running the backups (my laptop to two disks, my mini to two disks, Claudia’s mini and her movies to one disk) still takes about an hour. :(

AlexSchroeder 2006-09-29 07:54 UTC

Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.

Show Google +1