zeldor.biz

Linux, programming and more

Copyright © 2025
Log in

Accessing data on guest lvm

January 10, 2011 by Igor Drobot Leave a Comment

for my KVM guests I use only LVM disks, I find it easy to use and administer.
Every time you running out of space you can resize your lvn volume.
Bus some days ago I moved some virtual servers to another physical Dom0(Host) and was a little bit confused – how to move lvm – DD was not the best idea.

There is always another way, here is my:
Very important! Shut-down virtual machine.

Install kpartx to handle partitioned LVM:

1
aptitude install kpartx

aptitude install kpartx

To access LVM volumes, you must rescan LVM with vgscan and activate the volume group on the partition (called vg0 by default) by using the vgchange -ay command:

1
2
3
4
5
6
7
8
kpartx -a /dev/vg0/guest56
vgscan
#Reading all physical volumes . This may take a while...
#Found volume group "vg0" using metadata type lvm2
vgchange -ay vg0now
# 12 logical volume(s) in volume group vg0 now active.
lvs
mount /dev/vg0/guest56 /mnt/

kpartx -a /dev/vg0/guest56 vgscan #Reading all physical volumes . This may take a while... #Found volume group "vg0" using metadata type lvm2 vgchange -ay vg0now # 12 logical volume(s) in volume group vg0 now active. lvs mount /dev/vg0/guest56 /mnt/

After working on it – release it:

1
2
3
umount /mnt/
vgchange -an vg0
kpartx -d /dev/vg0/guest56

umount /mnt/ vgchange -an vg0 kpartx -d /dev/vg0/guest56

Filed Under: Debian, Linux Tagged With: Filesystem, LVM, restore data

Categories

Archives

Tags

apache2 Apple arduino ARM Automation backup bash Cisco Cluster Corosync Database Debian Debian squeeze DIY DNS Fedora FTP Fun Icinga Ipv6 KVM Linux LVM MAC OS X Monitoring MySQL Nagios Nginx openSUSE OpenVPN PHP Proxy Python python3 qemu RAID rsync Samba security ssh Ubuntu virtualization Windows Windows 7 Wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *

Yeaaah Cookie! We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok