Клонирование диска, добавленного в LVM

При клонировании диска, ранее добавленного в LVM, на выходе получим логический конфликт - UUID блочных устройств будут совпадать, о чём нам сообщит менеджер:

pvs
  Found duplicate PV 7Xk2Paipbhbpk4z3QU0xpqtjeDC0Jf8b: using /dev/vdb not /dev/vdc
  Using duplicate PV /dev/vdb without holders, replacing /dev/vdc
  PV         VG   Fmt  Attr PSize    PFree
  /dev/vdb   vg00 lvm2 a--  1020,00m    0 

pvdisplay

Нажмите, чтобы отобразить

Нажмите, чтобы скрыть

  --- Physical volume ---
  PV Name               /dev/vdb
  VG Name               vg00
  PV Size               1,00 GiB / not usable 4,00 MiB
  Allocatable           yes (but full)
  PE Size               4,00 MiB
  Total PE              255
  Free PE               0
  Allocated PE          255
  PV UUID               7Xk2Pa-ipbh-bpk4-z3QU-0xpq-tjeD-C0Jf8b


vgdisplay

Нажмите, чтобы отобразить

Нажмите, чтобы скрыть

  --- Volume group ---
  VG Name               vg00
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1020,00 MiB
  PE Size               4,00 MiB
  Total PE              255
  Alloc PE / Size       255 / 1020,00 MiB
  Free  PE / Size       0 / 0   
  VG UUID               vAh1eD-qoG3-e1h3-KUD0-NdOx-actC-IrRidA


lvdisplay

Нажмите, чтобы отобразить

Нажмите, чтобы скрыть

  --- Logical volume ---
  LV Path                /dev/vg00/lv01
  LV Name                lv01
  VG Name                vg00
  LV UUID                ZZ29Ki-aPTh-62Ad-PWGu-jykB-PHxr-K7sm9l
  LV Write Access        read/write
  LV Creation host, time i-8745-35715-VM, 2016-12-04 21:58:42 +0300
  LV Status              available
  # open                 0
  LV Size                508,00 MiB
  Current LE             127
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           252:0
   
  --- Logical volume ---
  LV Path                /dev/vg00/lv02
  LV Name                lv02
  VG Name                vg00
  LV UUID                gVX1e2-cTOd-iwSj-iSXf-4NIi-pRBY-eYRXSS
  LV Write Access        read/write
  LV Creation host, time i-8745-35715-VM, 2016-12-04 21:58:52 +0300
  LV Status              available
  # open                 0
  LV Size                512,00 MiB
  Current LE             128
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           252:1



Для решения такой проблемы имеется утилита vgimportclone:

vgimportclone -n old_vg_name new_pv
  • В контексте нашего примера выполняем:
vgimportclone -n vg00 /dev/vdc
  Found duplicate PV 7Xk2Paipbhbpk4z3QU0xpqtjeDC0Jf8b: using /dev/vdb not /dev/vdc
  Using duplicate PV /dev/vdb without holders, replacing /dev/vdc
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  WARNING: Activation disabled. No device-mapper interaction will be attempted.
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  Physical volume "/tmp/snap.orq5PSlR/vgimport0" changed
  1 physical volume changed / 0 physical volumes not changed
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  WARNING: Activation disabled. No device-mapper interaction will be attempted.
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  Volume group "vg00" successfully changed
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  Volume group "vg00" successfully renamed to "vg001"

pvdisplay

Нажмите, чтобы отобразить

Нажмите, чтобы скрыть

  --- Physical volume ---
  PV Name               /dev/vdc
  VG Name               vg001
  PV Size               1,00 GiB / not usable 4,00 MiB
  Allocatable           yes (but full)
  PE Size               4,00 MiB
  Total PE              255
  Free PE               0
  Allocated PE          255
  PV UUID               yCBF49-HTrc-K8Rt-1EtJ-kaXA-kKb7-KHwM3i
   
  --- Physical volume ---
  PV Name               /dev/vdb
  VG Name               vg00
  PV Size               1,00 GiB / not usable 4,00 MiB
  Allocatable           yes (but full)
  PE Size               4,00 MiB
  Total PE              255
  Free PE               0
  Allocated PE          255
  PV UUID               7Xk2Pa-ipbh-bpk4-z3QU-0xpq-tjeD-C0Jf8b


vgdisplay

Нажмите, чтобы отобразить

Нажмите, чтобы скрыть

  --- Volume group ---
  VG Name               vg001
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1020,00 MiB
  PE Size               4,00 MiB
  Total PE              255
  Alloc PE / Size       255 / 1020,00 MiB
  Free  PE / Size       0 / 0   
  VG UUID               eoUb4u-dDh8-vFOg-LVoR-j0nD-Uese-PFsCol
   
  --- Volume group ---
  VG Name               vg00
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1020,00 MiB
  PE Size               4,00 MiB
  Total PE              255
  Alloc PE / Size       255 / 1020,00 MiB
  Free  PE / Size       0 / 0   
  VG UUID               vAh1eD-qoG3-e1h3-KUD0-NdOx-actC-IrRidA


lvdisplay

Нажмите, чтобы отобразить

Нажмите, чтобы скрыть

  --- Logical volume ---
  LV Path                /dev/vg001/lv01
  LV Name                lv01
  VG Name                vg001
  LV UUID                ZZ29Ki-aPTh-62Ad-PWGu-jykB-PHxr-K7sm9l
  LV Write Access        read/write
  LV Creation host, time i-8745-35715-VM, 2016-12-04 21:58:42 +0300
  LV Status              NOT available
  LV Size                508,00 MiB
  Current LE             127
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
   
  --- Logical volume ---
  LV Path                /dev/vg001/lv02
  LV Name                lv02
  VG Name                vg001
  LV UUID                gVX1e2-cTOd-iwSj-iSXf-4NIi-pRBY-eYRXSS
  LV Write Access        read/write
  LV Creation host, time i-8745-35715-VM, 2016-12-04 21:58:52 +0300
  LV Status              NOT available
  LV Size                512,00 MiB
  Current LE             128
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
   
  --- Logical volume ---
  LV Path                /dev/vg00/lv01
  LV Name                lv01
  VG Name                vg00
  LV UUID                ZZ29Ki-aPTh-62Ad-PWGu-jykB-PHxr-K7sm9l
  LV Write Access        read/write
  LV Creation host, time i-8745-35715-VM, 2016-12-04 21:58:42 +0300
  LV Status              available
  # open                 0
  LV Size                508,00 MiB
  Current LE             127
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           252:0
   
  --- Logical volume ---
  LV Path                /dev/vg00/lv02
  LV Name                lv02
  VG Name                vg00
  LV UUID                gVX1e2-cTOd-iwSj-iSXf-4NIi-pRBY-eYRXSS
  LV Write Access        read/write
  LV Creation host, time i-8745-35715-VM, 2016-12-04 21:58:52 +0300
  LV Status              available
  # open                 0
  LV Size                512,00 MiB
  Current LE             128
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           252:1


  • Обращаем внимание на то, что логические тома нового устройства неактивны.
# lvs
  LV   VG    Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv01 vg00  -wi-a----- 508,00m                                                    
  lv02 vg00  -wi-a----- 512,00m                                                    
  lv01 vg001 -wi------- 508,00m                                                    
  lv02 vg001 -wi------- 512,00m 
  • Для активации выполняем:
lvchange -ay /dev/vg001/lv01
lvchange -ay /dev/vg001/lv02
# lvs
  LV   VG    Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv01 vg00  -wi-a----- 508,00m                                                    
  lv02 vg00  -wi-a----- 512,00m                                                    
  lv01 vg001 -wi-a----- 508,00m                                                    
  lv02 vg001 -wi-a----- 512,00m 
  • klonirovanie_diska_dobavlennogo_v_lvm.txt
  • Последние изменения: 2016/12/04 00:00
  • (внешнее изменение)