Mounting disks under OS X

[prev] [thread] [next] [lurker] [Date index for 2007/03/12]

From: David Cantrell
Subject: Mounting disks under OS X
Date: 23:28 on 12 Mar 2007
I have some disks which go to sleep if you don't use them often enough.
Yeah, they wake up if you poke them, but waiting for them to spin up is
annoying.  So I wrotea little cron job to periodically poke them by
touching a file.

This is a Mac, so they get mounted at boot time in /Volumes/$diskname.
Those directories don't really exist until it tries to mount the disk.
When it mounts the disk, it first creates the directory (which must not
previously exist), then says "wakey wakey Mr. Disc rise and shine it's a
glorious day here in Dave's flat!".

There's enough time between it creating the directory and the disk
waking up that sometimes my cron jobs that run every minute get a chance
to go "ooh, somewhere I can touch a file!".  Then when the disk has
stretched, yawned, scratched its arse and so on OS X goes "oh noes, teh
file is in ur directory!!! lolcats!!!" and so creates another directory
called "/Volumes/$diskname 1" and mounts it there.  Without bothering to
even make a cute honking noise like what every other error seems to.
At which point all my other fucking cron jobs go wrong, backups don't
happen, dogs lie down with cats, blah blah blah.

Bah.

So now the cron jobs check that there's actually a filesystem mounted
before doing anything.

-- 
David Cantrell | http://www.cantrell.org.uk/david

      Blessed are the pessimists, for they test their backups

Generated at 23:02 on 16 Mar 2007 by mariachi 0.52