View Single Post
  #1  
Old 09-23-2007, 08:07 PM
jimco
Guest
 
Posts: n/a
Scheduled backup to firewire drive on networked computer

I'm scheduling a backup to a volume on a firewire drive on another computer on a wireless network. The user's guide makes it sound like a snap but there were all kinds of issues to overcome. I pieced together hints from this forum and information from lots of other websites. In hopes that it will save someone else with the same need about 10 hours of work, I'm posting it here.

If anyone knows of easier or better ways of doing this than I've found, I would certainly appreciate detailed pointers.

Remote Computer (with attached backup drive)

This computer needs to wake up and mount the backup volume on the external disk before the source computer tries to mount it. I couldn't get it to mount remotely (from the source computer) any other way. Unexpectedly, I found that this cron event woke the computer up, so it was not necessary to set up a separate wake event. If it doesn't wake the computer for you, see the wake stuff for the source computer below.

Edit the crontab file ( /etc/crontab ) by adding this line. This would call for the mounting on Monday, Thursday and Saturday (1,4,6) at 1:00 am (0 1). Complete the disk* identifier with the identifier that Disk Utility gives it when it is mounted (get info).

Code:
0	1	*	*	1,4,6	/usr/sbin/diskutil mount /dev/disk*
If you know how to use pico (sudo pico /etc/crontab ) this is the easiest way to edit. You can also use TextEdit, but you have to first use Finder's Go>Folder menu command to navigate to /etc, then control-click to open with TextEdit, then save it on the Desktop (you don't have permission to overwrite the file), then replace it in the Finder using your administrator password, THEN reset the owner to root.

By the way, you will probably have to use the crontab command to read the edited file into the cron program. In theory it is supposed to update automatically but I guess I don't know how to make that happen. So just typing "crontab crontab" if you are in /etc works, or "crontab /etc/crontab" if you're not.

Source computer

On this computer, a cron event to mount the remote drive did not reliably wake up the computer, so the first step is to get it to wake up. You can do this with the Energy Saver prefs pane Schedule function. If you need a more flexible schedule (like Monday, Thursday and Saturday at 1 am, you can set it using pmset (power manager settings, which modifies the same settings file that the Energy Saver scheduler does) in Terminal with a command like this:

Code:
pmset repeat wake MRS 01:00:00
The next challenge is to mount the target volume connected to the remote computer. SuperDuper's manual says this will happen automatically after you first do it manually, but this did not happen for me - I got "can't mount" errors. I've tested two ways to do this and both seem to work:

EITHER: An undocumented (as far as I know) feature of SuperDuper is a place to add Applescripts that will fire before or after a copy job. Go to ~/Library/Application Support/SuperDuper!/Scheduled Copies ("~" refers to your home user folder). Here you will find your copy schedule file (assuming you already created it). Control-click on it and choose Show Package Contents. Then you will see a file called "Copy job.applescript". Open this in Script Editor, and you will see the comments clearly indicating where the pre- and post-backup scripts go.

One possibility is putting this script in the pre-backup slot:

Code:
try
  mount volume "afp://jimmy.local./Stuff" as user name "user" with password "password"
end try
For user and password, enter the info for a registered user of the remote computer. In this case, the computer's name is jimmy, and the volume on the attached firewire drive is Stuff.

OR: You can also mount the remote volumet with a cron job. Open crontab (see instructions for editing under Remote Computer above) and add these lines:

Code:
1	1	*	*	1,4,6	mkdir /Volumes/Stuff
2	1	*	*	1,4,6	/sbin/mount_afp afp://user:password@jimmy.local./Stuff /Volumes/Stuff
Modify for your names, etc. as indicated for the pre-backup applescript above. These two steps will happen at 1:01 and 1:02 am on the three days. Incidentally, there seems to be no way to do this successfully if there is no/blank password on the remote computer.

If you want to unmount/eject the volume when you're done, you can put the following applescript in "Copy job.applescript" (the post-backup slot) as shown above:

Code:
tell application "Finder"
  eject "Stuff"
end tell
delay 10
The backup job itself is scheduled in SuperDuper and should be a minute or so after mounting the remote volume.

Quite an ugly hack job, huh?

If you test this, expect SuperDuper to take about 5-10 minutes or so to mount the disk image on the remote volume. I don't know why that takes so long.

Jim
Reply With Quote