Protecting against disk failure with LVM Raid

Daniel Pittman daniel at rimspace.net
Wed Oct 4 09:40:29 UTC 2006


Nils <elitepenguin at gmx.net> writes:

> First of all, thx a lot for your answers!
>
> I'm not sure if I confused md and lvm. Are they somehow related, or
> can you also setup a software raid w/o lvm?

They are conceptually unrelated, but support some of the same
functionality.  

LVM stands for "Logical Volume Management" and is designed to abstract
away storage space from the physical media that underlays it.  

Aside from a range of other features the underlying toolkit that drives
this (dm, or "device mapper") has some degree of RAID support.

It provides three features (that I know of), RAID-0, RAID-1, and support
for vendor specific software RAID solutions.[1]


On the other hand we have the Linux MD (multiple device) subsystem.
That is considerably older than LVM[2], and has many more years of
debugging.

It supports more RAID levels, notably 5 and 6, but doesn't support
snapshots or other LVM space management features.


The two tools are complementary, in some ways, and many people use md
software RAID devices to underlay LVM managed space.

> I would also like to know if it's possible to add software RAID to a
> system thats already installed (w/o reinstalling it of course).

Yes, but it isn't trivial.  The MD subsystem needs some space on the
partition to store a header, so that it can keep track of which RAID
this device belongs to -- space that is used by a file system normally.

So, the easiest way is to add (and partition) your second disk, then
create an MD or LVM RAID with a "missing" disk.  Create your file system
on that, transfer all the data, then boot over to that as your root.

Once that is done you can add the "missing" disk -- which was your
original root disk -- and MD or LVM will automatically copy the data
into place for you.


This isn't entirely trivial; if you are intent on going ahead with it
have a look at the tools involved and then feel free to ask more
specific questions here.

Regards,
        Daniel

Footnotes: 
[1]  This is through the "dmraid" tool, which detects and assembles the
     RAID devices from the on-disk meta-data that the vendor BIOS uses.

     This supports all the "FakeRAID" stuff that you get on random
     motherboards these days.

[2]  Which, these days, represents version 2, a complete rewrite after
     version 1 turned out to be broken in a number of fundamental ways.
-- 
Digital Infrastructure Solutions -- making IT simple, stable and secure
Phone: 0401 155 707        email: contact at digital-infrastructure.com.au
                 http://digital-infrastructure.com.au/





More information about the ubuntu-server mailing list