Installation guide

System administrators use additional hard drives for to provide more storage space or to separate
system data from user data. This procedure, Procedure 9.1, “Adding physical block devices to virtual
machines , describes how to add a hard drive on the host to a guest.
The procedure works for all physical block devices, this includes CD-ROM, DVD and floppy devices.
Warning
The host should not use disk labels to identify file systems in the fstab file, the initrd file or
used by the kernel command line. If less privileged users, especially virtual machines, have
write access to whole partitions or LVM volumes the host system could be compromised.
Guests should not be given write access to whole disks or block devices (for example,
/dev/sdb). Virtual machines with access to block devices may be able to access other block
devices on the system or modify volume labels which can be used to compromise the host
system. Use partitions (for example, /dev/sdb1) or LVM volumes to prevent this issue.
Pro ced u re 9 .1. Ad d in g p h ysical b lo ck devices t o virt u al mach in es
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. Replace: myguest with your guest's name, /dev/sdb1
with the device to add, and sdc with the location for the device on the guest. The sdc must be
an unused device name. Use the sd* notation for Windows guests as well, the guest will
recognize the device correctly.
Append the --type cdrom parameter to the command for CD-ROM or DVD devices.
Append the --type floppy parameter to the command for floppy devices.
# virsh attach-disk myguest
/dev/sdb1
sdc --driver tap --mode readonly
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.
9.3. Configuring persist ent st orage in Red Hat Ent erprise Linux 5
This section is for systems with external or networked storage; that is, Fibre Channel or iSCSI based
storage devices. It is recommended that those systems have persistent device names configured for
your hosts. This assists live migration as well as providing consistent device names and storage for
multiple virtualized systems.
Universally Unique Identifiers(UUID s) are a standardized method for identifying computers and
devices in distributed computing environments. This sections uses UUIDs to identify iSCSI or Fibre
Channel LUNs. UUIDs persist after restarts, disconnection and device swaps. The UUID is similar to a
label on the device.
Chapt er 9 . Virt ualized st orage devices
133