Installation guide

Dell Inc.
KVM Virtualization in RHEL 6 Made Easy
14
6.3 Disk capacity
You can always add additional „disks‟ to your VMs by attaching additional file images. Say that you
want to add an additional 10 GB of disk space in your VM, here is what you do:
1. Create a 10-GB non-sparse file:
# dd if=/dev/zero of=/vm-images/vm1-add.img bs=1M count=10240
2. Shutdown the VM:
# virsh shutdown vm1
3. Add an extra entry for „disk‟ in the VM's XML file in /etc/libvirt/qemu. You can look copy & paste
the entry for your mail storage device and just change the target and address tags. For example:
# virsh edit vm1
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none' io='threads'/>
<source file='/vm-images/vm1.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04'
function='0x0'/>
</disk>
Add:
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none' io='threads'/>
<source file='/vm-images/vm1-add.img'/>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06'
function='0x0'/>
</disk>
make sure that the name of the device (i.e. vdb) follows the first one in sequential order
for the address tag, be sure to use a unique slot address, check with the address tag of ALL
devices (not just storage devices)
4. Restart the VM from the updated XML configuration file:
# virsh create /etc/libvirt/qemu/vm1.xml
7. Deleting VMs
When you no longer need a VM, it is best practice to remove it to free up its resources. A VM that is
shutdown is not taking up a VCPU or memory, but its image file is still taking up disk space.