LVM - unable to mirror LV
Hello guys,
I'm having problems to mirror a logical volume to two different PV. Code:
membit:~ # pvscan Code:
membit:~ # lvconvert -m 1 datavg/mirroredlv Code:
Kernel: 2.6.27.23-0.1-pae |
I happened to be building an LVM mirror when I saw this post so I was able to test your setup and confirm the problem. The error is not quite accurate since it sounds like you don't have enough space to build the mirror (which you obviously do) when the real problem is that LVM can't build the mirror log.
You have two methods available for storing the log. The first (and easiest) is to store it in memory by adding '--mirrorlog core' to your lvconvert command. The second is to add a third PV to your datavg VG. LVM defaults to the PV method and you only have two PVs in that VG which is why your lvconvert failed. The downside to using the memory based log is that your mirror will have to resync on every boot because LVM will not know the current state of the mirror. The log size is very small since it only requires 1 bit per mirror region. The mirror region size defaults to 512K but can be changed with '--regionsize <size in MB>'. If you use the PV log, be aware that prior to LVM2 2.02.44 the log size will be exactly 1 PE so you will want to increase the extent size on your PV when you create it and/or increase the region size on your mirror. Using the defaults for both will limit your mirror size to 16G (4K PE * 8 bits * 512K regionsize). |
Hi just a note to possibly save others some time with regard to conversion of lvm2 (linear) logical volumes to mirrored volumes using lvconvert, eg, to implement raid1 redundancy on an existing linear lv.
Since about September 2013, the default mirror segment type in lvm2 has been 'raid1' (not 'mirror'). This makes '--corelog' and '--mirrorlog disk/core/mirrored' options inapplicable in this default case, because raid1 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. There are two further implications. First, the command to create the mirror is simplified, because there is only a need to specify the lv to be mirrored, and the (usually one) pv on which the mirror segment will be stored: Code:
lvconvert -m1 /dev/my_vg/my_lv /dev/my_new_pv
In some cases this third space requirement causes a problem because there is no space in the existing lv for even 1 new LE to be allocated for the log. In this case, you might get an error such as: Code:
1 extents needed, but only 0 available The remedy is to resize the existing lv (and other lvs on the same pv, and the underlying filesystems, if necessary) so that there is enough space on the existing lv to allocate 1 additional PE for the log. In my case, for example, my existing pv was completely full, so I had to:
|
All times are GMT -5. The time now is 09:29 AM. |