========================================= I tested this on a USB device this way: [1] Format the usb device using fdisk [2] Create a PV, VG, LV [3] Create a qcow2 disk image - # qemu-img create -f qcow2 /dev/VG/LV 1.5G [4] Create OS on the above LV using virt-install - Boot it using qemu-kvm to see if it works [5] Now, create an overlay, w/ backing file as the LV - # qemu-img create -f qcow2 -b /dev/VG/LV sn1.qcow2 - Boot the overlay using qemu-kvm to see if it works [6] Now detach the usb stick [7] Once reattached, run a vgchange -a y ; lvchange --refresh, so that everything will be sane now. ========================================= ---------------------------------------------------- root@~$ fdisk /dev/sdb Command (m for help): p Disk /dev/sdb: 2101 MB, 2101346304 bytes 255 heads, 63 sectors/track, 255 cylinders, total 4104192 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: 0x000f3320 Device Boot Start End Blocks Id System /dev/sdb1 * 63 4096574 2048256 83 Linux Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): d Selected partition 1 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. root@~$ ---------------------------------------------------- https://rwmj.wordpress.com/2010/09/08/new-guestfish-n-options-in-1-5-9/ http://rwmj.wordpress.com/2010/10/06/visualizing-3-write-a-file-on-an-ext4-filesystem/ http://libguestfs.org/guestfish.1.html#prepared_disk_images https://rwmj.wordpress.com/2010/09/07/tip-pack-files-into-a-new-disk-image/ http://libguestfs.org/guestfs.3.html#guestfs_part_disk http://rwmj.wordpress.com/2010/09/24/tip-my-procedure-for-cloning-a-fedora-vm/ http://rwmj.wordpress.com/2010/09/28/how-lvm-does-snapshots/ ----------------------------------------------------- *** Logical Volumes *** ----------------------------- root@~$ pvcreate /dev/sdb Writing physical volume data to disk "/dev/sdb" Physical volume "/dev/sdb" successfully created ----------------------------- You can create VG using a single phsycial volume (or multiple physical volumes: like, vgcreate VG /dev/sdb /dev/sdc) ----------------------------- root@~$ vgcreate VG /dev/sdb Volume group "VG" successfully created ----------------------------- root@~$ pvscan PV /dev/sdb VG VG lvm2 [1.95 GiB / 1.95 GiB free] Total: 1 [1.95 GiB] / in use: 1 [1.95 GiB] / in no VG: 0 [0 ] root@~$ ----------------------------- root@~$ pvdisplay --- Physical volume --- PV Name /dev/sdb VG Name VG PV Size 1.96 GiB / not usable 4.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 500 Free PE 500 Allocated PE 0 PV UUID rgt2i3-OqOe-xa0V-m79K-7UMN-TFX0-DSZhJn root@~$ ----------------------------- root@~$ vgdisplay --- Volume group --- VG Name VG System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 1.95 GiB PE Size 4.00 MiB Total PE 500 Alloc PE / Size 0 / 0 Free PE / Size 500 / 1.95 GiB VG UUID Q2XAu8-OeCl-IUN0-c4lv-SnK9-Zp3K-oIw4Pw root@~$ ----------------------------- root@~$ lvdisplay root@~$ ----------------------------- ----------------------------- root@~$ lvcreate -L 1G -n LV VG Logical volume "LV" created ----------------------------- root@~$ lvdisplay --- Logical volume --- LV Name /dev/VG/LV VG Name VG LV UUID dKn1VQ-czGe-ZhAr-9ir0-eNd1-Zd93-e8Y3lY LV Write Access read/write LV Status available # open 0 LV Size 1.00 GiB Current LE 256 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 root@~$ ----------------------------- root@~$ dmsetup info Name: VG-LV State: ACTIVE Read Ahead: 256 Tables present: LIVE Open count: 0 Event number: 0 Major, minor: 253, 1 Number of targets: 1 UUID: LVM-Q2XAu8OeClIUN0c4lvSnK9Zp3KoIw4PwdKn1VQczGeZhAr9ir0eNd1Zd93e8Y3lY Name: luks-87dd0f89-4c83-49b8-be7c-20b988979c07 State: ACTIVE Read Ahead: 256 Tables present: LIVE Open count: 1 Event number: 0 Major, minor: 253, 0 Number of targets: 1 UUID: CRYPT-LUKS1-87dd0f894c8349b8be7c20b988979c07-luks-87dd0f89-4c83-49b8-be7c-20b988979c07 ----------------------------- root@~$ dmsetup table VG-LV: 0 2097152 linear 8:16 2048 luks-87dd0f89-4c83-49b8-be7c-20b988979c07: 0 173717504 crypt aes-xts-plain64 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 8:5 4096 root@~$ ----------------------------- root@~$ fdisk -l /dev/sdb Disk /dev/sdb: 2101 MB, 2101346304 bytes 65 heads, 62 sectors/track, 1018 cylinders, total 4104192 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: 0x00000000 Disk /dev/sdb doesn't contain a valid partition table root@~$ ----------------------------- ----------------------------- root@~$ lvextend -L+600 /dev/VG/LV Extending logical volume LV to 1.59 GiB Logical volume LV successfully resized ----------------------------- root@~$ lvdisplay --- Logical volume --- LV Name /dev/VG/LV VG Name VG LV UUID dKn1VQ-czGe-ZhAr-9ir0-eNd1-Zd93-e8Y3lY LV Write Access read/write LV Status available # open 0 LV Size 1.59 GiB Current LE 406 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 root@~$ ----------------------------- root@~$ lvextend -L+100 /dev/VG/LV Extending logical volume LV to 1.68 GiB Logical volume LV successfully resized root@~$ lvdisplay --- Logical volume --- LV Name /dev/VG/LV VG Name VG LV UUID dKn1VQ-czGe-ZhAr-9ir0-eNd1-Zd93-e8Y3lY LV Write Access read/write LV Status available # open 0 LV Size 1.68 GiB Current LE 431 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 root@~$ ----------------------------- ----------------------------- root@~$ qemu-img create -f qcow2 /dev/VG/LV 1.5G Formatting '/dev/VG/LV', fmt=qcow2 size=1610612736 encryption=off cluster_size=65536 ----------------------------- root@~$ qemu-img info /dev/VG/LV image: /dev/VG/LV file format: qcow2 virtual size: 1.5G (1610612736 bytes) disk size: 0 cluster_size: 65536 root@~$ ----------------------------- root@testvmimgs$ qemu-img create -f qcow2 -b /dev/VG/LV sn1.qcow2 Formatting 'sn1.qcow2', fmt=qcow2 size=1610612736 backing_file='/dev/VG/LV' encryption=off cluster_size=65536 ----------------------------- root@testvmimgs$ qemu-img info sn1.qcow2 image: sn1.qcow2 file format: qcow2 virtual size: 1.5G (1610612736 bytes) disk size: 136K cluster_size: 65536 backing file: /dev/VG/LV (actual path: /dev/VG/LV) root@testvmimgs$ ----------------------------- Now, let's try to boot the overlay ----------------------------- root@testvmimgs$ qemu-kvm -smp 2 -m 2048 sn1.qcow2 -nographic ----------------------------- root@testvmimgs$ vgs VG #PV #LV #SN Attr VSize VFree VG 1 1 0 wz--n- 1.95g 276.00m root@testvmimgs$ If you remove the phsycial usb & rettach, Run "vgchange", and "lvchange --refresh" ------------------------------------------------------------------------------- root@~$ vgchange -a y /dev/VG/LV: read failed after 0 of 4096 at 1807679488: Input/output error /dev/VG/LV: read failed after 0 of 4096 at 1807736832: Input/output error /dev/VG/LV: read failed after 0 of 4096 at 0: Input/output error /dev/VG/LV: read failed after 0 of 4096 at 4096: Input/output error 1 logical volume(s) in volume group "VG" now active ------------------------------------------------------------------------------- root@~$ lvchange --refresh /dev/VG/LV /dev/VG/LV: read failed after 0 of 4096 at 1807679488: Input/output error /dev/VG/LV: read failed after 0 of 4096 at 1807736832: Input/output error /dev/VG/LV: read failed after 0 of 4096 at 0: Input/output error /dev/VG/LV: read failed after 0 of 4096 at 4096: Input/output error ------------------------------------------------------------------------------- root@~$ lvchange --refresh /dev/VG/LV root@~$ ------------------------------------------------------------------------------- root@~$ qemu-img info /dev/VG/LV image: /dev/VG/LV file format: qcow2 virtual size: 1.5G (1610612736 bytes) disk size: 0 cluster_size: 65536 root@~$ -------------------------------------------------------------------------------