lvm redundancy

I’ve read that you can setup redundancy with lvm. I’ve never seen the reason why to do that, since in a server environment I’ve got some kind of raid in the bottom taking care of redundancy anyway .
The reason just came up, I had a situation where a server was setup without raid, and reinstallation was out of the question since developers was already working on the server. So here’s some hints regarding lvm mirroring.
First of all, you create lvm mirroring when creating logical volumes. as long as you got at least 2 physical disks and 1 volume group spread over those disks, all you need to do is add a couple options to lvcreate, for instance:

# lvcreate -m1 -L50G -n mirrored --corelog vg0 /dev/sda1 /dev/sdb1

Would create a 50GB logical volume in Volume Group vg0 with mirroring between /dev/sda1 and /dev/sdb1.
What’s even more cool is to use lvconvert to create a mirror of an already existing logical volume.

#lvconvert --mirrorlog core -m1 vg0/nonmirror

I did lvconvert on the root partition, no reboot required and ‘nobody’ even noticed I fixed redundancy ๐Ÿ™‚
Note: both examples uses ‘corelog’ which will write to ram resulting that mirrors will resync after _every_ reboot. NOT a very good thing, but in my opinion it’s better than not having any raid at all .
Lvm, by design, need a third disk for logging when you want mirroring and logs to be persistent over reboots . More info in

# man lvcreate
# apropos lvm

lvm                  (8)  - LVM2 tools
lvm.conf [lvm]       (5)  - Configuration file for LVM2
lvmchange            (8)  - change attributes of the logical volume manager
lvmconf              (8)  - LVM configuration modifier
lvmdiskscan          (8)  - scan for all devices visible to LVM2
lvmdump              (8)  - create lvm2 information dumps for diagnostic purposes
lvmsadc              (8)  - LVM system activity data collector
lvmsar               (8)  - LVM system activity reporter
perlvms              (1)  - VMS-specific documentation for Perl
pvcreate             (8)  - initialize a disk or partition for use by LVM
pvresize             (8)  - resize a disk or partition in use by LVM2

Thanks to tcpdump.com for helping me out here ๐Ÿ™‚

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.