Please do not reply directly to this email. All additional
comments should be made in the comments box of this bug.
https://bugzilla.redhat.com/show_bug.cgi?id=207470
Jaroslav Kortus <jkortus(a)redhat.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jkortus(a)redhat.com
--- Comment #28 from Jaroslav Kortus <jkortus(a)redhat.com> 2012-03-27 13:51:46 EDT
---
I found another way how to mount images which (may) have duplicate vg names:
1. setup loopback device with the name
2. setup loopback device for data you are going to write to it (must have)
3. use device mapper to map loopback device to dm target, read-only (will
allow us to use snapshots)
4. create writeable snapshot of the device from 3.
5. use kpartx to map partitions to new dm devices (kpartx -a <device from 4.>)
6. use vgcloneimport -n my_not_colliding_vg_name /dev/mapper/jkdev_snap2
(replace with output from 5)
7. pvscan, lvscan, vgchange ... all that fun you wish to do with the newly
created VG and its LVs
The reason for using this is that vgcloneimport destroys the mapping and
corrupts the image (no longer bootable without further changes) by changing
UUIDs/names. This way the changes go right to the snapshot and keeps the
original image intact.
If you wish to write to the original image while you are doing backup, it would
be better to create proper snapshot with snapshot-origins as described in
http://www.redhat.com/archives/dm-devel/2004-July/msg00071.html (use dm create
... --notable). For shutdown&examine (my case) this is probably the most simple
way.
Clean up via dmsetup remove <device> and losetup -d.
# sample script:
imgfile="/var/lib/libvirt/images/node02.img"
snapfile="/var/lib/libvirt/images/snapshot.img"
devname="jkdev"
snap="jkdev_snap"
loop1="/dev/loop1"
loop2="/dev/loop2"
# loop device
# map loop1 -> image file
# map loop2 -> snapshot file
losetup -r $loop1 $imgfile
dd if=/dev/zero of=$snapfile bs=1M seek=100 count=0
losetup $loop2 $snapfile
# map dm -> loop1
dmsetup -r create $devname --table "0 `blockdev --getsize $loop1` linear $loop1
0"
# snapshot mappings
dmsetup create $snap --table "0 `blockdev --getsize /dev/mapper/$devname`
snapshot /dev/mapper/$devname $loop2 p 64 "
--
Configure bugmail:
https://bugzilla.redhat.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.