1

It appears that my virt-install xml file (i.e. created when defining a VM) specifies targets "hda", "hdb", and so on as the devices for disks, however, the VM, once created, lists /dev/sda, /dev/sdb, etc... for its devices.

Is the target device name not guaranteed to be honored when creating new Linux VM's in virt-install? If so, how can we determine what a device name will be before the VM is created?

I also recall similar issues in AWS with externally mounted disks, so maybe there is some missing piece to the puzzle of the guarantees provided when devices are named and mounted which I am not aware of.

3

The hypervisor cannot influence the device naming of the guest. Modern Linux distros call most disk types sda. If a disk appears to the guest as such type then it is called sdx.

The hda refers towards the hypervisor to the first disk.

| improve this answer | |
  • Hmmmm... and so how to hda, hdb, get translated into "real" disk devices, which as you say, are mapped to sda, sdb? – jayunit100 Jul 5 '13 at 0:38
  • The documentation says: "Treat it as a device ordering hint." Disks are ordered by their address (first the controller ID, then the disk ID). For SATA this means the port number. I guess if you do not explicitly give the device address then libvirt uses the target name as an ordering hint when it determines the addresses. It should be possible to set conflicting values if you configure both. – Hauke Laging Jul 5 '13 at 1:09
  • Thanks, I've posed this as a separate question here: might be useful to someone. unix.stackexchange.com/questions/81824/… – jayunit100 Jul 5 '13 at 1:30
2

I think this is just how it works. All my KVM instances I've created all contain this:

<target dev='hda' bus='ide'/>

And yet every single one of them has their HDD as not /dev/sda but /dev/vda, for example:

$ sudo fdisk -l

Disk /dev/vda: 10.7 GB, 10737418240 bytes
16 heads, 63 sectors/track, 20805 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007cd99

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           3        1018      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2            1018       20806     9972736   8e  Linux LVM
Partition 2 does not end on cylinder boundary.

Until you mentioned this I never even noticed this before. I've created VMs using virt-install, virt-manager and cobbler and they always show up like this.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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