How to convert striped LV to linear LV
Environment
- Redhat Enterprise Linux 5.8 and later
- LVM2
Issue
- How to convert striped LV to linear LV within the logical volume manager ?
- Is it possible to convert an LVM striped logical volume to a linear/concatenated logical volume ?
Resolution
- Below are the steps to convert striped LV to Linear LV.
-
There is no direct command to convert striped LV to Linear. First you need to convert it to a mirrored volume and then to a Linear volume.
-
First add a PV to the existing VG
# lvs -a -o +devices stripelv stripevg -wi-a- 7.47G /dev/hdb1(0),/dev/hdb2(0),/dev/hdb3(0),/dev/hdb4(0) # pvcreate /dev/hdd1 Writing physical volume data to disk "/dev/hdd1" Physical volume "/dev/hdd1" successfully created # vgextend stripevg /dev/hdd1 Volume group "stripevg" successfully extended # vgs VG #PV #LV #SN Attr VSize VFree VolGroup00 1 2 0 wz--n- 14.88G 0 stripevg 5 1 0 wz--n- 21.45G 13.98G -
Then convert the striped LV to mirrored LV.
# lvconvert -m 1 stripevg/stripelv Insufficient suitable allocatable extents for logical volume : 1912 more required Unable to allocate extents for mirror(s). -
If you get the above error, add another physical device to the Volume group so that the logs can be kept on the disk and then try to run the lvconvert command.
-
The log can also be kept in memory with the
--mirrorlog coreoption so that no extra physical volume is needed to mirror the device.# lvconvert --mirrorlog core -m 1 stripevg/stripelv stripevg/stripelv: Converted: 0.0% stripevg/stripelv: Converted: 1.2% stripevg/stripelv: Converted: 2.4% stripevg/stripelv: Converted: 3.5% . . stripevg/stripelv: Converted: 97.0% stripevg/stripelv: Converted: 98.0% stripevg/stripelv: Converted: 99.1% stripevg/stripelv: Converted: 100.0% [root@localhost ~]# -
Once the mirror is completed successfully verify it as below.
# lvs -a -o +devices LV VG Attr LSize Origin Snap% Move Log Copy% Convert Devices stripelv stripevg mwi-a- 7.47G 100.00 stripelv_mimage_0(0),stripelv_mimage_1(0) [stripelv_mimage_0] stripevg iwi-ao 7.47G /dev/hdb1(0),/dev/hdb2(0),/dev/hdb3(0),/dev/hdb4(0) [stripelv_mimage_1] stripevg iwi-ao 7.47G /dev/hdd1(0) -
Then convert the mirrored LV to linear LV with the below command.
#lvconvert -m 0 stripevg/stripelv /dev/hdb1 /dev/hdb2 /dev/hdb3 /dev/hdb4 Logical volume stripelv converted. [root@localhost ~]# [root@localhost ~]# -
Verify with the below command.
# dmsetup table | grep stripelv stripevg-stripelv: 0 15663104 linear 22:65 384Or with
# lvdisplay
Root Cause
- There is not direct command to convert a Striped LV to Linear LV. First you need to convert it to a mirrored LV and then to a Linear LV.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments