Installation guide
Chapter 27. Volumes
240
i. write changes to disk and quit.
Command (m for help): w
Command (m for help): q
j. Format the new partition with the ext3 file system.
# mke2fs -j /dev/sdb1
7. Mount the disk on the guest.
# mount /dev/sdb1 /myfiles
The guest now has an additional virtualized file-based storage device.
27.3.2. Adding hard drives and other block devices to a guest
System administrators use additional hard drives to provide increased storage space for a guest, or to
separate system data from user data.
Procedure 27.1. Adding physical block devices to virtualized guests
This procedure describes how to add a hard drive on the host to a virtualized guest. It applies to all
physical block devices, including CD-ROM, DVD and floppy devices.
1. Physically attach the hard disk device to the host. Configure the host if the drive is not accessible
by default.
2. Configure the device with multipath and persistence on the host if required.
3. Use the virsh attach command as below, replacing:
# virsh attach-disk myguest /dev/sdb1 sdc --driver tap --mode readonly
• myguest with the name of the guest.
• /dev/sdb1 with the device on the host to add.
• sdc with the location on the guest where the device should be added. It must be an unused
device name.
Use the sd* notation for Windows guests as well, the guest will recognize the device correctly.
• Only include the --mode readonly parameter if the device should be read only to the guest.
Additionally, there are optional arguments that may be added:
• Append the --type hdd parameter to the command for CD-ROM or DVD devices.
• Append the --type floppy parameter to the command for floppy devices.
4. The guest now has a new hard disk device called /dev/sdb on Linux or D: drive, or similar,
on Windows. This device may require formatting.