With a littile work you can back up your mac every day automatically to an external, bootable drive partition without paying for backup software. All you need is a firewire or USB external drive, your OS X installation disc and a little patience.
First, get out your external drive and open Disk Utility. Click on your external drive and go to ‘Partitions’. What you want is to partition this external drive with a primary partition that is the same size as your Mac’s internal hard disk. Create the ‘Backup’ partition - make sure to carefully size it right, name it ‘Backup’ and under ‘options’ select ‘GUID Partition Table’ for Intel or ‘Apple Partition Map’ for PowerPC. Partition the remaining space on your HD as ‘Storage’. Then, and this is important, right click the Backup partition (on your desktop), select “Get Info” and uncheck the “ignore permissions” checkbox. I use my 250GB external HD as a 75 GB ‘Backup’ partition and a 157 GB ‘Storage’ disk. After you have your partitions configured and they’re formatted you can start backing up your mac.
Now let’s setup the scripts that will backup your disc each night. Insert your Mac OS X install disc and open a terminal (/Applications/Utilities/Terminal) and type (cut and paste) the following:
# Gain root permissions
sudo su -
# Copy OS X Hide Utility to your HD
cd '/Volumes/Mac OS X Install Disc 1'
cd './System/Installation/Packages'
cd './OSInstall.mpkg/Contents/Resources/'
cp ./SetHidden /usr/local/bin/hide
# Setup the list of system files to hide on the backup
cat > /usr/local/etc/backup-hide << EOF
automount
bin
cores
dev
etc
mach
mach_kernel
private
sbin
tmp
Trash
usr
var
VM Storage
Volumes
Desktop DB
Desktop DF
Desktop Folder
lost+found
mach.sym
opt
.hidden
.Trashes
.vol
Network
Mac OS 9/Desktop Folder
System/Library/CoreServices/Finder
Applications/Utilities/Print Center.app
EOF
# Setup the list of files to exclude from backup
cat > /usr/local/etc/backup-exclude << EOF
/.VolumeIcon.icns
/Network/*
/Previous*
/Volumes/*
/afs/*
/automount/*
/cores/*
/private/tmp/*
/private/var/launchd/*
/private/var/run/*
/private/var/spool/postfix/*
/private/var/vm/*
/tmp/*
EOF
# Setup our script for backups
cat > /usr/local/bin/backup << EOF
#!/bin/sh
if test -d /Volumes/Backup ; then
rsync -auxSEH --delete \\
--exclude-from=/usr/local/etc/backup-exclude \\
/ /Volumes/Backup/
/usr/local/bin/hide \\
/Volumes/Backup/ \\
/usr/local/etc/backup-hide > /dev/null
bless -folder \\
/Volumes/Backup/System/Library/CoreServices
fi
EOF
chmod 755 /usr/local/bin/backup
# Setup the backups to run every night at 3am
mkdir /Library/LaunchDaemons
cat > /Library/LaunchDaemons/backup.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC
"-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>backup</string>
<key>LowPriorityIO</key>
<true/>
<key>Nice</key>
<integer>10</integer>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/backup</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>3</integer>
</dict>
<key>UserName</key>
<string>root</string>
</dict>
</plist>
EOF
launchctl load /Library/LaunchDaemons/backup.plist
# Run the backup once as root to prime the exteranal HD
sudo su - /usr/local/bin/backup ; # This will take a while exit
Now that we have everything setup, reboot and hold down the [alt] key while the inital grey Apple boot screen appears. You should see two drives now, one is your internal drive and one that says “Backup”. Boot from your backup drive to make sure it is working. It should be an EXACT copy of your internal drive. It’s easy to get confused so don’t mess around too long before rebooting back to your internal drive.
One last final step is to make sure your mac is “awake” at 3am so that the backup runs at 3am. Open System Preferences and go to Energy Saver and select Schedule. Make sure your Mac is set to “Start up or wake everyday at 2:59am” so the backup will run on time at 3:00am. If you have your energy settings set to suspend, the mac will go back to sleep after the backup.
Done!
Posted on August 21st, 2007 by dysinger
Filed under: Uncategorized