![]() Now my scripts are smart enough to handle changes in the backup disk’s device file. So here’s the new version of mount_backup: 1: #!/bin/bashģ: BDISK=`/usr/sbin/diskutil list | awk '$3="Backup" '`Ĥ: /usr/sbin/diskutil unmount $BDISK > /dev/null Since the name of my backup disk is “Backup,” I can figure out its device file by looking at the last field in the line that has “Backup” in its third field. The only partition that can be mounted is the last one, with the name “HD” and the device file “disk0s3.” If you’re working at a computer with an external drive plugged in, you’ll get a set of lines for that drive, and the only mountable partitions will be the ones with names. The lines refer to the internal hard disk and its partitions. This is the output I just got running the command on my iBook, which is the computer I’m in front of right now. If you run diskutil list, you’ll get something like this: /dev/disk0 It turns out that diskutil can do more than mount and unmount disks. 1 Clearly, I needed something more foolproof. That worked for a few days, and then there was another failure because the device file had changed again. No problem, I thought, I’ll just get the new device file and put it into the mount and unmount scripts. The first backup I tried after the change to Leopard and the upgrade to SuperDuper failed because the device file changed and the mounting script failed. A similar script, called “unmount_backup,” was called after the backup. I then made a shell script, called “mount_backup,” that ran diskutil with that device and had SuperDuper call it before starting the backup. When I first started using SuperDuper, I ran Disk Utility and clicked the Info button to learn that the backup disk was disk3s10. The problem with mounting the backup disk is knowing which one of these device files corresponds to that disk. Device files are kept in the /dev directory, and if you run ls /dev/disk*, you’ll see a few of these device files. Device files are an old Unixism one of Unix’s big ideas was to make everything look like a file so reading and writing to a hardware device (like a disk or a serial port) is as simple as reading and writing to a file. The disk0s3 is the device file for a particular partition on a particular disk. Here’s an example: diskutil mount disk0s3 ![]() The shell command for mounting a disk is pretty simple. SuperDuper’s scheduler has the ability to run scripts before and after the backup, and I use this to mount the disk before the backup and unmount it after. I keep my backup disk unmounted to prevent inadvertent data loss, mounting it only during the backup itself. Let me first say that failing to find the backup disk wasn’t SuperDuper’s fault. ![]() Happily, GeekTool told me that the backup didn’t work (and, er, SuperDuper stayed open with red letters all over the place, so maybe my GeekTool script isn’t necessary), and I think I now have a permanent solution to the problem. For the most part, this has worked well, but on two occasions the backup failed because SuperDuper couldn’t find the backup disk. I have SuperDuper set up to backup the iMac every weeknight. I recently installed Leopard on my work computer (an Intel iMac) and upgraded SuperDuper to the Leopard-compatible version 2.5. ![]() Next post Previous post SuperDuper! scripts
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |