LVM Volume aus KVM Image mounten

srv01# losetup /dev/loop0 /var/lib/libvirt/images/vmFSvm-rails.qcow2
srv01# kpartx -av /dev/loop0
add map loop0p1 (253:0): 0 497664 linear /dev/loop0 2048
add map loop0p2 (253:1): 0 41439234 linear /dev/loop0 501758
add map loop0p5 : 0 41439232 linear 253:1 2

srv01# fdisk -lu /dev/loop0

Disk /dev/loop0: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000412e5

Device Boot Start End Blocks Id System
/dev/loop0p1 * 2048 499711 248832 83 Linux
/dev/loop0p2 501758 41940991 20719617 5 Extended
/dev/loop0p5 501760 41940991 20719616 8e Linux LVM
srv01# lvdisplay
— Logical volume —
LV Path /dev/rails/root
LV Name root
VG Name rails
LV UUID sNfv19-M132-gVTb-2o2D-rmx8-YG0g-uSK2xE
LV Write Access read/write
LV Creation host, time ,
LV Status NOT available
LV Size 18,88 GiB
Current LE 4833
Segments 1
Allocation inherit
Read ahead sectors auto

— Logical volume —
LV Path /dev/rails/swap_1
LV Name swap_1
VG Name rails
LV UUID cdzPoA-KgTU-Ds02-prP2-nGJO-0yNZ-FCOVHA
LV Write Access read/write
LV Creation host, time ,
LV Status NOT available
LV Size 884,00 MiB
Current LE 221
Segments 1
Allocation inherit
Read ahead sectors auto

srv01# vgchange -a y
2 logical volume(s) in volume group „rails“ now active
srv01# lvdisplay
— Logical volume —
LV Path /dev/rails/root
LV Name root
VG Name rails
LV UUID sNfv19-M132-gVTb-2o2D-rmx8-YG0g-uSK2xE
LV Write Access read/write
LV Creation host, time ,
LV Status available
# open 0
LV Size 18,88 GiB
Current LE 4833
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:3

— Logical volume —
LV Path /dev/rails/swap_1
LV Name swap_1
VG Name rails
LV UUID cdzPoA-KgTU-Ds02-prP2-nGJO-0yNZ-FCOVHA
LV Write Access read/write
LV Creation host, time ,
LV Status available
# open 0
LV Size 884,00 MiB
Current LE 221
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:4

srv01# mount /dev/rails/root /media/rails_root

srv01# umount /media/rails_root
srv01# vgchange -an
0 logical volume(s) in volume group „rails“ now active
srv01# lvdisplay
— Logical volume —
LV Path /dev/rails/root
LV Name root
VG Name rails
LV UUID sNfv19-M132-gVTb-2o2D-rmx8-YG0g-uSK2xE
LV Write Access read/write
LV Creation host, time ,
LV Status NOT available
LV Size 18,88 GiB
Current LE 4833
Segments 1
Allocation inherit
Read ahead sectors auto

— Logical volume —
LV Path /dev/rails/swap_1
LV Name swap_1
VG Name rails
LV UUID cdzPoA-KgTU-Ds02-prP2-nGJO-0yNZ-FCOVHA
LV Write Access read/write
LV Creation host, time ,
LV Status NOT available
LV Size 884,00 MiB
Current LE 221
Segments 1
Allocation inherit
Read ahead sectors auto

srv01# kpartx -dv /dev/loop0
srv01# virsh start vm-rails
Domain vm-rails started

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert