# converting from lvm and reiserfs to raid-1

## Moriah

I have a server with an 80 gb ide drive.  I also have another server with 2 80 gb ide drives.  Both are running lvm.  I just added a 250 gb drive to the server with 2 80 gb drives.  I am going to pull out one of the 80 gb drives after the 250 gb is fully up and running.  I am doing the pvmove right now to free up the drive that will be pulled.

Given that I have this 80 gb drive, and a server with no redundancy, I thought it would be nice to convert that server over to raid-1 mirroring instead of just a single 80 gb drive.

I know that mirroring with raid-1 allows you to boot from that raid, but is there a convenient way to add the second drive and configure the pair in a raid-1 mirror without doing a complete backup and resttore of the contents of the 80 gb drive?  The backup is done automatically every night, but the restoree will take a while, as the backup and restore work over the network, and the server is on the dmz, so I have to use ssh instead of nfs, and the server is a slow box, so the crypto loads it pretty heavily.  Besides, since this is my web and email server, I hate to take it down for very long.

What I am hoping is that I can just add the second 80 gb drive and configure it as 1 drive in a pair of raid-1, and just not add the second drive to the raid-1 pair yet.  Since its raid, it should still work with a drive offline, right?  So then I copy the contents of the booted drive to the new drive that is half of the raid-1.

Once I have that, then I can swap the 2 drives and reboot.  This time, I should be booted from a raid-1 that just happend to deliberately have an offline drive.  Now I should be able to add the old 80 gb drive to the raid-1 to make a mirrored pair.  The raidhotadd will start the recovery process.  When this finishes, I should have a bootable mirrored raid-1 with the same filesystem on it that I had on the original 80 gb drive, only now it will ride thru a drive failure because of the mirroring.

Of course, if I really thought it was that simple, I would not post a help request!  I have glossed over a critical point: how do I boot from the newly configured raid-1 that is as yet only a single drive?  Can I do this with a manually entered grub command?  Or do I have to physically swap the drivews so the new 1/2-raid-1 is in the boot drive position?  Do I have to edit the /etc/raidtab file on the new 1/2-raid-1 drive before I reboot, so it thinks that drive is the boot drive?  My uncertainty stems from how to make it boot from the new drive that is 1 drive in the raid-1 pair.

This box is running right now off of a single 80 gb drive, with a /boot partition of 50 MB, and the rest is all under lvm management.  The swap and / filesystem are both under lvm, which means it boots from an lvm root filesystem.  I want all this to be preserved, only I want the dual redundancy of the mirrorwed raid-1 pair so the box will cruise thru a drive failure without going down.

Is this feasable, or am I dreaming?  I know I can do it by rebuilding the system from a fresh install, but I would rather not have to take it offline that long, as it is my web and email server.  I also want to let /dev/md0 see both drives as whole drives, not partitions.  The partitions will be put on top the the /dev/md0 raid device.

Or should I just keep the freed up 80 gb drive for a spare and let it sit on the bookshelf until a drive fails somewhere?   :Sad: 

----------

## Kraymer

I think that what you want is possible  :Smile: 

You should format one of your 80G-drives and set up an appropriate /etc/raidtab file. The trick is to set one drive faulty (the one which shall still hold data not not be overwritten). As far as I know, your md device will be mountable. You can copy over your files then and afterwards use raidhotadd to sync the other drive and get a synced mirror!

Sorry, I can't guarantee for it to work, but reading the output of mdadm --help and my suggestions could enable you to do it I guess. Just be3 careful that your data-holding drive will be set faulty so that it isn*'t overwritten!

If you're still unsure about specific commands, just ask and I'll try to help

Sebastian

----------

## Moriah

Your approach is good. I was trying to figgure out how to boot the thing from the old non-raid drive, and then add in the new drive. That woudl have been easier, but your idea is still easier than doing a restore over the network.

Making the other drive unmountable is a piece of cake, as both drives will be mounted in "mobile carriers" for easy removal.

It turns out that I will be doing it a bit differently anyway. With the price of hardware as low as it is today, I am going to build a new server, and keep the old server up until the new one passes QC. That is the safest approach, and it will minimize internet visible server downtime as well.

I am actually going to build 3 idendical machines, except the other 2 will have 250 GB drives in the raid-0, and will alaso have hot standby drives. The web/email server will recycle the 80 GB drives that get freed up, and the old 200 MHz web server will move into the seconday name server's slot, replacing a Packard-Bell P-75. The P-75 is over 10 years old, and has earned it full pension.   :Wink: 

----------

## Kraymer

Oh well, that's a very safe way indeed  :Wink:   As you can afford it, I wish good luck and fun migrating your web services. In fact, I'll also make hardware upgrades within my server and migrate from a debian woody (stable yes but lacking new features that I find in gentoo) to gentoo, like you with software raid. I'm really looking forward to this, that server stuff is real fun   :Cool: 

Enjoy!

Sebastian

----------

## Moriah

This 3-way machine upgrade is a result of needing to upgrade my backup server, and my NIDS.  I do 100% packet logging on all zones in my network for forensic purposes, and right now, my network traffic has increased to the point where I can only keep 4 days of packet logs on a pair of 80 GB drives under LVM.  The upgrade will put the packet logs on a mirrored pair of 250 GB drives and give me hopefully over a week of logs for some time to come.

The backup server upgrade is part of an major software enhancement to my backup software.  I hope to turn both the backup server and the NIDS ionto a commercial "applliance" type box in the future.  I need room for a postgreSQL  database on both of these boxes for the upgrades I am planing.

----------

