[TriLUG] Adding second HDD then mirroring it

Matt Pusateri mpusateri at wickedtrails.com
Tue Nov 22 11:05:36 EST 2005


John,

What you want to do is possible.  From my experience and someone
correct me if I am wrong.  You can't change the orginal harddrive to a
raid system after the data is on it.  It has to do with how the raid
tools record the raid information in the superblocks and also the
partition type has to change.  I have tried to do this as an excersise
and failed due to invalid super-blocks.  What you have to do is this.

Add the new drive, boot with something like knoppix.

1. congfigure new drive to have a raid partition type (FD I think).
you can use the following to dump the partition table of the orginal
disk

sfdisk -d /dev/<original_disk_device> > partition.out

Then use that file to put the partition table on the new disk

sfdisk /dev/<new_disk_device> < partition.out

Next use fdisk to go change the partition type on the new disk to
linux raid on the partitions you want to raid.

2. Then create each raid device on the new disk with a missing raid
member
mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2
/dev/<new_disk_device> missing

The "missing" after the new disk device is to create a md device with
one drive and one missing drive.

You may at this point have to do a mdadm -assemble, see the mdadm man
page. I can't remember off the top of my head.

3. you should now have MD devices, cat /proc/mdstat use e2fs or what
ever tools you need to put the file system structure on the MD device.

4. mount the old disk in some mount point, the new disk in some mount
points and rysnc over the data from the new to the old.  I would rsync
over each individual mount point.

5. chroot into the new mount points, Edit the fstab and inittab files
in /etc to refer to the new MD device.  Edit grub.conf as well.

also sometimes you need to make a new intird, it depends if your
kernel recognizes the md devices upon reboot.  If you do need to make
a new initrd, make sure you mount /proc in your chroot before you
do,so that the md devices are picked up.

6. reboot and hope everything comes up.  If it does and things are
stable on you md devices, then you can use the mdadm command to add
your  original disk into the raid.  Personally if I were to do this I
would start with two new disks and just create the raid with both of
them and then not have to worry about using your old disk in the new
array. It will make your life easier.

Sorry this is a quick down and dirty of how to do it.  I suggest
looking at the various raid Howto's.  Here's one that's a little old
as it refers to raidtab, which is not used anymore as the raid info is
stored on disk in a superblock.

http://www.tldp.org/HOWTO/Software-RAID-HOWTO.html


Matt P.

On Tue, November 22, 2005 9:59 am, John-David Henderson wrote:
> Yes, this is what I want to do. Thank you
>
>  -----Original Message-----
> From: 	Brian Henning [mailto:brian at strutmasters.com]
> Sent:	Tue Nov 22 09:52:15 2005
> To:	Triangle Linux Users Group discussion list
> Subject:	Re: [TriLUG] Adding second HDD then mirroring it
>
> Just to clarify:
>
> What you want to do is turn your normal, single-drive system into a
RAID-1 array by adding a drive and mirroring to it?
>
> I'm pretty sure all RAID tools are capable of that.  I'd start by
looking at software RAID, since your system is already up and
running.
> Try googling for "software raid linux".  I'm sure other people will
pipe
> up to give more info as well.
>
> Cheers!
> ~Brian
>
>
> John-David Henderson wrote:
>> I have an issue that needs to be addressed.  Can someone direct me
where I can find out how to add a second HDD to an existing RedHat
9.0 install then somehow mirror the drive?
>> Thanks.
>> JD Henderson M:919.649.5589 jd at savagegeek.com
>
> --
> ----------------
> Brian A. Henning
> strutmasters.com
> 336.597.2397x238
> ----------------
> --
> TriLUG mailing list        :
> http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>
>
> --
> TriLUG mailing list        :
> http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>
>







More information about the TriLUG mailing list