Installation guide

Adding file based storage to a guest
239
<source file='/var/lib/libvirt/images/FileName.img'/>
<target dev='sdb'/>
</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
The guest now uses the file FileName.img as the device called /dev/sdb. This device requires
formatting from the guest. On the guest, partition the device into one primary partition for the
entire device then format the device.
a. Press n for a new partition.
# fdisk /dev/sdb
Command (m for help):
b. Press p for a primary partition.
Command action
e extended
p primary partition (1-4)
c. Choose an available partition number. In this example the first partition is chosen by entering
1.
Partition number (1-4): 1
d. Enter the default first cylinder by pressing Enter.
First cylinder (1-400, default 1):
e. Select the size of the partition. In this example the entire disk is allocated by pressing Enter.
Last cylinder or +size or +sizeM or +sizeK (2-400, default 400):
f. Set the type of partition by pressing t.
Command (m for help): t
g. Choose the partition you created in the previous steps. In this example, the partition number
is 1.
Partition number (1-4): 1
h. Enter 83 for a linux partition.
Hex code (type L to list codes): 83