BackupPC-users

Re: [BackupPC-users] Script for managing mdadm add/removes

2008-10-07 01:16:04
Subject: Re: [BackupPC-users] Script for managing mdadm add/removes
From: dan <dandenson AT gmail DOT com>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Mon, 6 Oct 2008 23:12:25 -0600
Your best bet here is to use udev rule for the device

whenever the drive gets plugged in it should run the script

[SCRIPT1]
add the device to the array so it can sync.

launch a script in the background that watches the sync and when it is 100% complete, remove the disk from the array. (use while and awk probably)
eject the disk
notify you via email.

make sure you are generous with `sleep` commands.  some things take a few seconds to settle so a 30 second wait here or there is a good thing.


I will certainly give any help I can but I really suggest that you read this on writing udev rules http://reactivated.net/writing_udev_rules.html
also, a quick while loop using awk to pull out the specific field you need for the while.  this shouldnt be terribly hard.
eject /dev/sdb is pretty straightforward

it will be very helpfull for you to learn to do this so i suggest you put as much effort into this as you can before getting any help.

good luck.





On Mon, Oct 6, 2008 at 4:40 PM, Kim Pedersen <kim AT cncsltd DOT com> wrote:

Hi everyone,

I have been following the discussions about using Linux md raid1 as a
way of creating an offline copy of the pool filesystem, which method Les
Mikesell seems to be a big proponent of.

I am about to try it out myself on an installation, where users will
connect an external harddrive to the BackupPC server and sync the drive
to the raid1 array using mdadm, and later disconnect it again for
offline/offsite storage.

As this is something that will happen on a regular basis, I am looking
to automate it as much as practical (and possible) by writing a script
for the umount/fail/remove and recognition of the external drives.

Might there be someone on the list who have taken a shot at this already
and be willing to share the code to get me jump started?


Regards,

Kim Pedersen



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url="">
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/