[linux-lvm] Mirrored LV

Koen Vermeer koen at vermeer.tv
Tue Sep 23 08:41:22 UTC 2008

On Fri, 2008-09-19 at 22:39 -0500, Jonathan Brassow wrote:
> Just to answer some questions:
> You can use just 2 disks to create a mirror and a disk log:
> prompt> lvcreate --alloc anywhere -m1 -L 500M -n my_lv my_vg
> I wish the allocation policy 'normal' (which is the default) would  
> also do this... but instead you must choose a looser allocation policy  
> to get what you want.

With vg_test already containing 2 equally sized PVs (one on /dev/sda,
the other on /dev/sdb), I did this:
vgextend vg_test /dev/sda6
lvconvert -m 1 vg_test/XP
(XP is a small LV with an XP image, /dev/sda6 is a small partition)
That seems to work fine:
lvs -a -o +devices
  XP                     vg_test   mwi-ao  15.00G
XP_mlog 100.00         XP_mimage_0(0),XP_mimage_1(0)                  
  [XP_mimage_0]          vg_test   iwi-ao
15.00G                                           /dev/sda4(2560)                                
  [XP_mimage_1]          vg_test   iwi-ao
15.00G                                           /dev/sdb3(0)                                   
  [XP_mlog]              vg_test   lwi-ao
4.00M                                           /dev/sda6(0) 

> The reason that you want the disk-based log is to prevent all the  
> extra work when you machine comes up.

Yes, I understand that now. It wasn't clear from the documentation that
with corelog, it would rebuild the whole mirror.

> The reason that LVM wants a separate disk for the log is so the head  
> on the storage device doesn't need to go ping-ponging around the  
> device.  (The log is touched for almost every write.)  So, its a  
> performance thing... and possibly a not-wear-out-your-hardware thing  
> too.

I see. So I guess that means that in the general case, an LVM-mirror
approach is not a good substitute for an LVM-on-RAID1 approach? My
original rationale was to have a more flexible system by using
LVM-mirror than I'd get when using LVM-on-RAID1.

What I'd expect is some way to have the log lazily cached in memory. In
that way, there is no ping-ponging, you'd only have to rebuild the
log/mirror when there is a power outage and you wouldn't have the
startup delays, i.e. something like a regular filesystem.

> It won't matter if the master disk with the log dies.  Your mirror  
> will simply become a linear device composed of the last remaining disk  
> anyway.

That makes sense, at least with two drives.

Thanks for your comments!


More information about the linux-lvm mailing list