6

I created a striped and mirrored logical volume with the following command:

$ lvcreate -i 2 -m 1 -L 300M -n lvbig vgdata

If I use lvdisplay with option -m however the output shows that the new volume is mirrored but it does not give information about its stripes. How can I get a complete information about a logical volume which is both striped and mirrored? It seems that lvdisplay displays the stripes only if the volume is not at the same time mirrored, instead displaying only mirrors when it is both.

I also tried with the following:

$ lvs --segments

with the same result: the volume results of a mirror type, no information being also a striped volume.

9

You can use lvs command with additional fields to display the LV layout, including the number of stripes. For example 3 LVs here with stripes used together with raid, mirror and plain striped layout:

# lvs -o+lv_layout,stripes
  LV    VG     Attr       LSize   Log          Cpy%Sync Layout      #Str
  lvol0 vg     rwi-a-r---   8.00m              100.00   raid,raid10    4
  lvol1 vg     mwi-a-m---   8.00m [lvol1_mlog] 100.00   mirror         2
  lvol2 vg     -wi-a-----   8.00m                       striped        2

If you'd like to see even more, including internal LVs which are used to construct the top-level LV (and their exact layouts), you can use:

#lvs -a -o+lv_layout,lv_role,stripes,devices
  LV               VG     Attr       LSize   Log          Cpy%Sync Layout      Role                  #Str Devices                                                                
  lvol0            vg     rwi-a-r---   8.00m              100.00   raid,raid10 public                   4 lvol0_rimage_0(0),lvol0_rimage_1(0),lvol0_rimage_2(0),lvol0_rimage_3(0)
  [lvol0_rimage_0] vg     iwi-aor---   4.00m                       linear      private,raid,image       1 /dev/sda(1)                                                            
  [lvol0_rimage_1] vg     iwi-aor---   4.00m                       linear      private,raid,image       1 /dev/sdb(1)                                                            
  [lvol0_rimage_2] vg     iwi-aor---   4.00m                       linear      private,raid,image       1 /dev/sdc(1)                                                            
  [lvol0_rimage_3] vg     iwi-aor---   4.00m                       linear      private,raid,image       1 /dev/sdd(1)                                                            
  [lvol0_rmeta_0]  vg     ewi-aor---   4.00m                       linear      private,raid,metadata    1 /dev/sda(0)                                                            
  [lvol0_rmeta_1]  vg     ewi-aor---   4.00m                       linear      private,raid,metadata    1 /dev/sdb(0)                                                            
  [lvol0_rmeta_2]  vg     ewi-aor---   4.00m                       linear      private,raid,metadata    1 /dev/sdc(0)                                                            
  [lvol0_rmeta_3]  vg     ewi-aor---   4.00m                       linear      private,raid,metadata    1 /dev/sdd(0)                                                            
  lvol1            vg     mwi-a-m---   8.00m [lvol1_mlog] 100.00   mirror      public                   2 lvol1_mimage_0(0),lvol1_mimage_1(0)                                    
  [lvol1_mimage_0] vg     iwi-aom---   8.00m                       striped     private,mirror,image     2 /dev/sda(2),/dev/sdb(2)                                                
  [lvol1_mimage_1] vg     iwi-aom---   8.00m                       striped     private,mirror,image     2 /dev/sdc(2),/dev/sdd(2)                                                
  [lvol1_mlog]     vg     lwi-aom---   4.00m                       linear      private,mirror,log       1 /dev/sdd(3)                                                            
  lvol2            vg     -wi-a-----   8.00m                       striped     public                   2 /dev/sda(3),/dev/sdb(3)                
2
  • 1
    I do not know what version of lvm you have, I installed lvm2. If I use lvs with the options you suggest I receive a Unrecognised field: lv_layout, Unrecognised field: lv_role. – Asarluhi Aug 31 '17 at 19:08
  • 1
    The lv_layout and lv_role fields are available since lvm2 version 2.02.110 (~ August 2014). – Peter Rajnoha Sep 1 '17 at 10:53

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.