At Wed, 9 Jun 2010 16:50:53 -0700 CentOS mailing list <centos at centos.org> wrote: > > Hi, > > I've used mdadm for years now to manage software raids. > > The task of using fdisk to first create partitions on a spare drive > sitting on a shelf (raid 0 were my 1st of 2 drives failed) is kind of > bugging me now. > > After using fdisk to create the same partition layout on the new drive > as is on the existing drive and then using mdadm to finish every thing > up is a little tedious. > > Any one have an idea how to have a sort of hot plug were I just swap > out the drive and it rebuilds? sfdisk is your friend (from man sfdisk): -d Dump the partitions of a device in a format useful as input to sfdisk. For example, % sfdisk -d /dev/hda > hda.out % sfdisk /dev/hda < hda.out will correct the bad last extended partition that the OS/2 fdisk creates. So: 1) plug in replacement disk. 2) partition it: # sfdisk -d /dev/sdX | sfdisk /dev/sdY Where /dev/sdX is an existing disk and /dev/sdY is the replacement disk 3) add the partition(s) to the array(s): # mdadm /dev/mdI ... -a /dev/sdYI # mdadm /dev/mdJ ... -a /dev/sdYJ # mdadm /dev/mdK ... -a /dev/sdYK # mdadm /dev/mdL ... -a /dev/sdYL No reason not to put all of the above in a script... > > > - aurf > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos > > -- Robert Heller -- Get the Deepwoods Software FireFox Toolbar! Deepwoods Software -- Linux Installation and Administration http://www.deepsoft.com/ -- Web Hosting, with CGI and Database heller at deepsoft.com -- Contract Programming: C/C++, Tcl/Tk