Apr 5 2008

Syncing to Time Capsule
Comments Off

I got really excited about the Apple Time Capsule when it was released. I had two 500GB duplicate external hard drives chained off of my Mac Book Pro to backup my rather large collection of media. I typically use rsync to copy files to the drives and keep them in sync.

The only problem with my setup was that it required me to connect these drives to my laptop and eject them as I move my computer around the house. Time Capsule solves this by making my setup wireless.

You can view the hard drive volumes mounted on your Mac from the terminal:

$> ls /Volumes
./                    Macintosh HD@
../                   Derek's Time Capsule/

When using a Time Capsule drive, it may not appear in /Volumes if it isn’t mounted. You can mount your drive with a simple bash script that uses mount_afp.

Save as mount_capsule.sh

# configure - enter your capsule name, ip, and username:password
CAP_NAME="Derek's Time Capsule"
if ! [ -d "/Volumes/$CAP_NAME" ]; then
  echo "[info] Mounting $CAP_NAME..."
  mkdir "/Volumes/$CAP_NAME"
  mount_afp "afp://$USER@$CAP_IP/$CAP_NAME" "/Volumes/$CAP_NAME"
echo "[info] $CAP_NAME mounted"

And now let’s make the script executable and run it.

$> chmod 744 mount_capsule.sh
$> ./mount_capsule.sh
[info] Mounting Derek's Time Capsule...
[info] Derek's Time Capsule mounted

Once we’ve mounted the drive, we can proceed to copy/move/rsync data to it.

rsync -avz --delete /Users/derek/work /Volumes/Derek's Time Capsule/backup

Sorry, the comment form is closed at this time.