Red Hat ENTERPRISE LINUX 5 - VIRTUALIZATION GUIDE Manual page 151

Hide thumbs Also See for ENTERPRISE LINUX 5 - VIRTUALIZATION GUIDE:
Table of Contents

Advertisement

1.
Create an empty container file or using an existing file container (such as an ISO file).
a.
Create a sparse file using the dd command. Sparse files are not recommended due to data
integrity and performance issues. Sparse files are created much faster and can used for
testing but should not be used in production environments.
# dd if=/dev/zero of=/var/lib/libvirt/images/FileName.img bs=1M seek=4096 count=0
b.
Non-sparse, pre-allocated files are recommended for file-based storage images. Create a
non-sparse file, execute:
# dd if=/dev/zero of=/var/lib/libvirt/images/FileName.img bs=1M count=4096
Both commands create a 400MB file which can be used as additional storage for a virtualized
guest.
2.
Dump the configuration for the guest. In this example the guest is called Guest1 and the file is
saved in the users home directory.
# virsh dumpxml Guest1 > ~/Guest1.xml
3.
Open the configuration file (Guest1.xml in this example) in a text editor. Find the <disk>
elements, these elements describe storage devices. The following is an example disk element:
<disk type='file' device='disk'>
<driver name='tap' type='aio'/>
<source file='/var/lib/libvirt/images/Guest1.img'/>
<target dev='xvda'/>
</disk>
4.
Add the additional storage by duplicating or writing a new <disk> element. Ensure you specify
a device name for the virtual block device attributes. These attributes must be unique for each
guest configuration file. The following example is a configuration file section which contains an
additional file-based storage container named FileName.img.
<disk type='file' device='disk'>
<driver name='tap' type='aio'/>
<source file='/var/lib/libvirt/images/Guest1.img'/>
<target dev='xvda'/>
</disk>
<disk type='file' device='disk'>
<driver name='tap' type='aio'/>
<source file='/var/lib/libvirt/images/FileName.img'/>
<target dev='hda'/>
</disk>
5.
Restart the guest from the updated configuration file.
# virsh create Guest1.xml
6.
The following steps are Linux guest specific. Other operating systems handle new storage
devices in different ways. For other systems, refer to that operating system's documentation
Adding storage devices to guests
137

Advertisement

Table of Contents
loading

Table of Contents