Ubuntu 24.04
Sponsored Link

Create Mirroring Volume2024/05/29


Create Mirroring Volume.

[1] For example, create a Mirroring Volume with Physical Volume [/dev/sdb1] and [/dev/sdc1].
# create volume group [vg_mirror] with [/dev/sdb1] and [/dev/sdc1]

vgcreate vg_mirror /dev/sdb1 /dev/sdc1

  Volume group "vg_mirror" successfully created

# create mirroring volume

lvcreate -L 50G -m1 -n lv_mirror vg_mirror

  Logical volume "lv_mirror" created.

lvdisplay /dev/vg_mirror/lv_mirror

  --- Logical volume ---
  LV Path                /dev/vg_mirror/lv_mirror
  LV Name                lv_mirror
  VG Name                vg_mirror
  LV UUID                Hy8a5e-Rd2c-lF2f-GGiR-iw8C-0SP7-71dZBY
  LV Write Access        read/write
  LV Creation host, time dlp.srv.world, 2024-05-29 01:22:11 +0000
  LV Status              available
  # open                 0
  LV Size                50.00 GiB
  Current LE             12800
  Mirrored volumes       2
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:5
[2] Configure like follows if you'd like to set mirroring volume from a logical volume which is already running.
# extend volume group

vgextend vg_data /dev/sdc1

  Volume group "vg_data" successfully extended

# set mirror volume

lvconvert -m1 /dev/vg_data/lv_data /dev/sdc1
# confirm : complete to sync if Cpy%Sync turns to 100


  LV        VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  ubuntu-lv ubuntu-vg -wi-ao---- <78.00g
  lv_mirror vg_mirror rwi-a-r---  50.00g                                    48.46
[3] Unset Mirroring Volume.
# specify -m0 to unset

lvconvert -m0 /dev/vg_mirror/lv_mirror

Are you sure you want to convert raid1 LV vg_mirror/lv_mirror to type linear losing all resilience? [y/n]: y
  Logical volume vg_mirror/lv_mirror successfully converted.
lvs -a -o vg_name,name,devices,size

  VG        LV        Devices      LSize
  ubuntu-vg ubuntu-lv /dev/sda3(0) <78.00g
  vg_mirror lv_mirror /dev/sdb1(1)  50.00g
Matched Content