Bug#427880: Script to automatically add a new harddrive with multiple RAID1 partitions

Arno van Amersfoort a.c.j.van.amersfoort at eld.physics.leidenuniv.nl
Thu Jun 7 07:26:21 UTC 2007


Package: mdadm
Version: 2.5.6-9

I wrote a script (see attachement) to automatically add a new harddrive 
to a system which already has a harddrive with multiple RAID1 
partitions. Now one has manually create a partition table on the new 
drive, copy the MBR (if bootable), create SWAP (if used) and do a mdadm 
--add for each partition. My script automates this process. This is 
especially handy when a harddisk containing multiple RAID1 partitions 
fails and is replaced by a new empty one.

Example:
When the system has 2 harddives, sda & sdb and looks like this:
- sda1/sdb1 (type fd) part of /dev/md0 (RAID1)
- sda2/sdb2 (type 82) swap
- sda5/sdb5 (type fd) part of /dev/md1 (RAID1)

When sdb fails and is replaced with a new (empty) harddrive. A single 
command like: "mdadd.sh /dev/sda /dev/sdb" is sufficient. This will 
completely restore the array and even the swap is recreated on the sdb.

I hope it's usefull.





-- 
Ing. A.C.J. van Amersfoort (Arno)
Department Of Electronics (ELD, k1007)
Huygens Laboratory
Leiden University
P.O. Box 9504
Niels Bohrweg 2
2333 CA Leiden
The Netherlands
----------------------------------------------------------------
Phone : +31-(0)71-527.1894   Fax: +31-(0)71-527.5819
E-mail: a.c.j.van.amersfoort at eld.physics.leidenuniv.nl
----------------------------------------------------------------
Arno's (Linux firewall) homepage: http://rocky.eld.leidenuniv.nl








-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mdadd.sh
Url: http://lists.alioth.debian.org/pipermail/pkg-mdadm-devel/attachments/20070607/d37600b5/attachment-0001.txt 


More information about the pkg-mdadm-devel mailing list