[lug] Automated USB Drive Backup

Charles Hutchinson chutchin at geekboi.org
Fri Oct 26 06:16:54 MDT 2007


karl horlen wrote:
> I've never used a USB external drive with linux
> before.  
> 
> I'd like to create some rsync scripts to backup
> directories to the external drive.  Manual scripts are
> pretty straightforward. However, I'd like to be able
> to automate the process so that the script fires when
> the drive is plugged in.
> 
> I'm wondering if current distros are capable of
> automounting and autoUNmounting these external drives
> RELIABLY when plugged in and removed.
> 
> Is this functionality available in most stock installs
> or do you usually have to post install rpms?  If rpms,
> which one(s)?  FYI, I'm using CentOS but am curious
> about how other distros handle this as well.
> 
> I imagine this is triggered by an fstab parameter?
> 
> On linux can you just unplug the drive or must you
> "prep" it before doing so to prevent data loss? 
> Normally on windows based systems you have to manually
> "stop" the drive before you remove it, probably to
> write out buffers or cache or something.
> 
> Does an automount "event" or some other method exist
> that I could capture in a script to trigger the
> backup?    I could setup up a cron job to poll and
> check if the drive on the mount point was available
> but I would need a way to prevent the backup job from
> continuously re-firing on each iteration of the cron
> job while the drive is plugged in.  It can be done but
> I thought the ability to capture a single event would
> simplify this.

Perhaps autofs would be appropriate here?  It does have a timeout option 
that will unmount a volume when it has not been accessed in a set time 
period.  For my NFS shares I have it set to unmount after 2 minutes.

Charlie



More information about the LUG mailing list