Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

5.4.16.6. Splitting off a RAID Image as a Separate Logical Volume

You can split off an image of a RAID logical volume to form a new logical volume. The procedure for splitting off a RAID image is the same as the procedure for splitting off a redundant image of a mirrored logical volume, as described in Section 5.4.3.2, “Splitting Off a Redundant Image of a Mirrored Logical Volume”.
The format of the command to split off a RAID image is as follows:
lvconvert --splitmirrors count -n splitname vg/lv [removable_PVs]
Just as when you are removing a RAID images from an existing RAID1 logical volume (as described in Section 5.4.16.5, “Changing the Number of Images in an Existing RAID1 Device”), when you remove a RAID data subvolume (and its associated metadata subvolume) from the middle of the device, any higher numbered images will be shifted down to fill the slot. The index numbers on the logical volumes that make up a RAID array will thus be an unbroken sequence of integers.

Note

You cannot split off a RAID image if the RAID1 array is not yet in sync.
The following example splits a 2-way RAID1 logical volume, my_lv, into two linear logical volumes, my_lv and new.
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                      
  my_lv             12.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sde1(1)                 
  [my_lv_rimage_1]        /dev/sdf1(1)                 
  [my_lv_rmeta_0]         /dev/sde1(0)                 
  [my_lv_rmeta_1]         /dev/sdf1(0)                 
# lvconvert --splitmirror 1 -n new my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV      Copy%  Devices     
  my_lv          /dev/sde1(1)
  new            /dev/sdf1(1)
The following example splits a 3-way RAID1 logical volume, my_lv, into a 2-way RAID1 logical volume, my_lv, and a linear logical volume, new
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                                     
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sde1(1)                                
  [my_lv_rimage_1]        /dev/sdf1(1)                                
  [my_lv_rimage_2]        /dev/sdg1(1)                                
  [my_lv_rmeta_0]         /dev/sde1(0)                                
  [my_lv_rmeta_1]         /dev/sdf1(0)                                
  [my_lv_rmeta_2]         /dev/sdg1(0)                                
# lvconvert --splitmirror 1 -n new my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV            Copy%  Devices                      
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sde1(1)                 
  [my_lv_rimage_1]        /dev/sdf1(1)                 
  [my_lv_rmeta_0]         /dev/sde1(0)                 
  [my_lv_rmeta_1]         /dev/sdf1(0)                 
  new                     /dev/sdg1(1)