[TriLUG] How to migrate LVM to LVM on Raid-1

Brian McCullough bdmc at bdmcc-us.com
Thu Feb 16 14:01:39 EST 2006


Rick,

You're laughing.  Having a completely unused disk available makes the
job _so_ much easier.


On Thu, Feb 16, 2006 at 01:26:31PM -0500, Rick DeNatale wrote:
> Having just recovered from a failed SCSI hard drive, I'd now like to
> put my second SCSI drive to work mirroring the first.
> 
> I've always had good backups of my user and config data, but it was
> still a pain to get my machine back on it's feet.
> 
> When I replaced the drive, I re-installed Ubuntu 5.10 on /dev/sda using LVM.
> 
> The installer setup two partitions, one for /boot and another for an
> LVM PV, and one VG with two LVs, one for /root and one for swap.
> 
> I'd now like to jack that up and install MDM software raid under it. 
> The Ubuntu kernel seems to be built with support for mdadm raid.  I've
> looked at a few how-tos but my head is still swimming and I'm, as
> always leery of doing low-level drive operations.  I've also backed up
> /dev/sda using g4linux.

Belt _and_ suspenders, I like that.


> It looks like the trick is to duplicate the partitioning of /dev/sda
> on /dev/sdb after changing partition types to Linux raid autodetect,

actually, before.

On sdb you create a partition that is the same size as your sda LVM
partition, and then use the rest for, say, swap or temp.


> and then do some mdmadmin magic to create a raid "device".  I'm a


Correct.  I'm sure that others will also observe that there are a couple
of approaches.

One would be:

Make sdb2 of type raid autodetect, and then configure mdadm to
see it as a RAID 1, half-partition. ( "broken", in that there is no
actual mirror drive, yet. )

Since md presents the view of a "disk drive" to all layers above,
including LVM, LVM won't know or care what kind of "disk drive" it is
running on.

Create a new PV using the new md partition, and allocate a new VG on
that PV.  Create a new LV on that VG, of appropriate size, format it and
copy all of / on to that new LV.


Swap sdb for sda and, once you are satisfied that the system still
boots, reverse the process.




> If I'm reading some of the things I've found correctly, I might not
> want to put the /boot partition in a raid cluster since grub seems to
> have problems with that.  If that's the case I guess I can manually
> back it up as needed when new kernels get installed, perhaps using
> rsync, yes?


Correct to both.


> I'm looking for some advice/encouragement


Go for it!


If I have been my usual obstruse self, feel free to ask questions.  I
originally did something like this several years ago, and don't repeat
it often enough to be absolutely certain, so don't hesitate to point out
where I drifted off track.  I got most -- or all -- of this from the
LVM-RAID HOWTO.


Brian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2229 bytes
Desc: not available
URL: <http://www.trilug.org/pipermail/trilug/attachments/20060216/28e9bddd/attachment.bin>


More information about the TriLUG mailing list