[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Fwd: confusion on KVM virtualization (debian admin handbook)



Sorry missed the list somehow.

On Tue, Mar 25, 2014 at 5:16 PM, Muhammad Yousuf Khan <sirtcp@gmail.com> wrote:
Thanks for sharing your thought.

just learn from some where, that "creating disk with virt-install can only create raw on the other hand qcow2 first needs to be initiated as volume"

Thanks,
 
That's not true. From the virt-install man page:

format
Image format to be used if creating managed storage. For file volumes, this can be 'raw', 'qcow2', 'vmdk', etc. See format types in <http://libvirt.org/storage.html> for possible values. This is often mapped to the driver_type value as well. With libvirt 0.8.3 and later, this option should be specified if reusing and existing disk image, since libvirt does not autodetect storage format as it is a potential security issue. For example, if reusing an existing qcow2 image, you will want to specify format=qcow2, otherwise the hypervisor may not be able to read your disk image.

Example vm creation on my local station:

igorc@silverstone:~$ virt-install --connect qemu:///system -n ubuntu08 -r 512 --cpu=host --vcpus=1 --disk path=/var/lib/libvirt/images/ubuntu08.img,size=7,sparse=false,format=qcow2,cache=writethrough,io=native,bus=virtio --initrd-inject=preseed.cfg --extra-args="install auto=true priority=critical netcfg/hostname=ubuntu08 initrd=/mnt/iso/install/initrd.gz preseed/file=preseed.cfg" --os-type linux --os-variant ubuntuprecise --vnc --noautoconsole --accelerate --network=bridge:virbr0,model=virtio --hvm --location /mnt/iso

Starting install...
Retrieving file version.info...                                                                                                                                                              |  116 B     00:00 ... 
Retrieving file linux...                                                                                                                                                                     | 9.9 MB     00:00 ... 
Retrieving file initrd.gz...                                                                                                                                                                 |  35 MB     00:00 ... 
Allocating 'virtinst-linux.F33Jaw'                                                                                                                                                           | 5.0 MB     00:00     
Transferring virtinst-linux.F33Jaw                                                                                                                                                           | 5.0 MB     00:01     
Allocating 'virtinst-initrd.gz.XsGiEW'                                                                                                                                                       |  18 MB     00:00     
Transferring virtinst-initrd.gz.XsGiEW                                                                                                                                                       |  18 MB     00:05     
Allocating 'ubuntu08.img'                                                                                                                                                                    | 7.0 GB     00:00     
Creating domain...                                                                                                                                                                           |    0 B     00:01     
Domain installation still in progress. You can reconnect to 
the console to complete the installation process.

igorc@silverstone:~$ qemu-img info /var/lib/libvirt/images/ubuntu08.img
image: /var/lib/libvirt/images/ubuntu08.img
file format: qcow2
virtual size: 7.0G (7516192768 bytes)
disk size: 136K
cluster_size: 65536

No problems at all. You can have problems and see "Format cannot be specified for unmanaged storage." only if you try creating image outside libvirt storage pool, and therefor it doesn't know how to create a qcow2 disk image. The storage pools are found/created from the VMM manager going to Edit->Connection Details->Storage or via virsh console:

virsh pool-define-as --name my-pool --type dir --target /some/path/here
virsh pool-start my-pool


Reply to: