Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I recently found that the target=hda tag in virsh was actually not translating into guest OS (guest OS's use /dev/sdX as the disk device names, in general, it seems).

virt-install and /dev/hda vs. /dev/sda

I am thus now wondering, what is the meaning of the "target dev" declarations which comprise my virt-install / virsth dumped XML files?

<disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/VirtualMachines/bthadoop-sda.raw'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/sandbox1'/>
      <target dev='hdb' bus='ide'/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
share|improve this question

2 Answers 2

Take a look at the reference documentation for the libvirt domain XML files, specifically this section: Hard drives, floppy disks, CDROMs.

target

The target element controls the bus / device under which the disk is exposed to the guest OS. The dev attribute indicates the "logical" device name. The actual device name specified is not guaranteed to map to the device name in the guest OS. Treat it as a device ordering hint.

The optional bus attribute specifies the type of disk device to emulate; possible values are driver specific, with typical values being "ide", "scsi", "virtio", "xen", "usb" or "sata". If omitted, the bus type is inferred from the style of the device name (e.g. a device named 'sda' will typically be exported using a SCSI bus).

The optional attribute tray indicates the tray status of the removable disks (i.e. CDROM or Floppy disk), the value can be either "open" or "closed", defaults to "closed". NB, the value of tray could be updated while the domain is running.

Since 0.0.3; bus attribute since 0.4.3; tray attribute since 0.9.11; "usb" attribute value since after 0.4.4; "sata" attribute value since 0.9.7

share|improve this answer

Just agreeing with slm, target device depends on the driver used by host and guest OS. Doesn't have to match.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.