Title: Configure Storage Options
Course: CIS 208: Linux/UNIX III: Intermediate System Administration, Networking, and Security ~ For IGNITE Review > Section: Learning Modules

Storage pools are used to create volumes, which are virtual hard drives.  By default there is one pool available, which can be seen with this command.

virsh pool-list

To see the volumes which have been create in a pool, run this command.  It will show the name and the full path to the volume.

virsh vol-list default

Several image types are supported, and the most common are qcow2, raw and vmdk.  The qcow2 type is native to qemu and supports snapshots.  The raw type contains the raw data that would be found on a real disk drive.  The vmdk type is used by VMWare. The raw image type is the fastest.

To create a volume, select a filename which usually indicates the name of the virtual machine and a size.

dd if=/dev/zero of=/var/lib/libvirt/images/myguest.img bs=1M count=8192

If a qcow2 type is desired, select a filename and a size.  Note that the file will be much smaller than the desired size, but it will grow with time to be not larger than the size selected.

qemu-img create -f qcow2 -o preallocation=metadata myguest.qcow2 20G

When importing other file types such as .vmdk or .vdi, the qemu-img program can autodetect the type and convert it to a preferred format.  Use this example to convert a vmdk type file to raw.

qemu-img convert import.vmdk -O import.img

This type of conversion will allow virtual machines created in other environments to be easily imported and to obtain the highest levels of performance.