toralf Developer
Joined: 01 Feb 2004 Posts: 3922 Location: Hamburg
|
Posted: Sat Sep 06, 2014 6:50 pm Post subject: HOWTO: mount a compressed qcow2 file |
|
|
Task: change the file /etc/conf.d/hostname of a cloned qemu KVM qcow2 file, if / is the 4th partition, from "n22kvm" to "n22kvmclone": Code: |
$> cd /var/lib/libvirt/images/
$> qemu-img convert -c -f qcow2 -O qcow2 -o cluster_size=2M Gentoo.qcow2 Gentoo-clone.qcow2
$> modprobe nbd
$> qemu-nbd -c /dev/nbd4 -P 4 /var/lib/libvirt/images/Gentoo-clone.qcow2
$> mkdir /mnt/ramdisk/p4
$> mount /dev/nbd4 /mnt/ramdisk/p4
$> sed -i -e 's/n22kvm/n22kvmclone/' /mnt/ramdisk/p4/etc/conf.d/hostname
$> umount /mnt/ramdisk/p4
|
|
|