9

On the lvconvert(8) man page it says:

--type SegmentType
       Used to convert a logical volume to another segment type  or  to
       explicitly  state  the  desired  RAID1 segment type ("mirror" or
       "raid1") when converting a linear logical  volume  to  a  mirror
       with the '-m' argument.

But what exactly is the difference between "mirror" and "raid1"?

2 Answers 2

7

I have not yet tried the new LVM segment types, but the overview is that they are support for the Linux MD RAID personalities in LVM. That is, they are RAID levels 1, 5, 6 etc. using the MD code with the eventual goal of removing the duplicate functionality of LVM's mirroring and having both MD and LVM use the same code.

This is very new stuff so may not be appropriate for a production setup yet.

For example it is still considered a technology preview in RHEL 6.2:

http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/6.2_Release_Notes/storage.html

3
  • So this is similar to creating a RAID with mdadm that uses multiple LVs as disks just with tighter integration into LVM?
    – Julian
    Apr 14, 2012 at 16:01
  • 2
    The point with RAID is to use multiple physical disks for gaining fault-tolerance and/or improved performance. mdadm on the top of LVM doesn't make much sense, but LVM on the top of mdadm was considered "best practice" when not having a hardware raid. Now that LVM supports RAID out of the box, it seems preferable (due to the flexibility offered) to rather use the RAID-support in LVM, but I suppose mdadm (or hardware RAID) is still needed for a bootable fault-tolerant setup.
    – tobixen
    Oct 20, 2012 at 11:33
  • Will raid1 eventually replace mirror in the temporarily created hidden LV for the implementation of pvmove? Mar 30 at 13:47
8

The practical difference is that the 'raid1' mirror segment type always stores its logs (in fact, metadata subvolumes) on-disk on the same PVs as the lv being mirrored. You no-longer need a third pv for the log, or to store the log in-memory, and consequently the --corelog and --mirrorlog disk/core/mirrored options to lvconvert are not applicable to the raid1 mirror segment type.

Another practical difference is that you need an additional 1 PE on both PVs (original and mirror) in order to store the log(s), allocated when the mirror is created. If you see an error like 1 extents needed, but only 0 available when trying to create a raid1 type mirror with lvconvert, this is probably a failure to allow 1 PE additional space for the log on each of the PVs.

Since about September 2013, raid1 has been the default mirror segment type in lvm2.

2
  • so how does one fix "If you see an error like 1 extents needed, but only 0 available when trying to create a raid1 type mirror with lvconvert," more to the point, I'm a bit lost on where I need to allocate the space for the log, in the pv or in the vg
    – Stu
    Feb 6 at 13:49
  • I found the answer in another post: the problem isn't unavailable space on the new leg of the raid1, it's the unavailable space on the original disk where the lv was sized to fill the pv and there's nowhere to put the log, you have to shrink the lv by one extent so it has somewhere to put the mirror log on the old/original pv.
    – Stu
    Feb 7 at 2:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.