# Attach disk to vm failed

**URL:** <https://forum.opennebula.io/t/attach-disk-to-vm-failed/874>\
**Category:** Product Support\
**Created:** [June 15, 2015, 7:35am UTC](https://forum.opennebula.io/t/attach-disk-to-vm-failed/874 "2015-06-15T07:35:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![111](https://avatars.discourse-cdn.com/v4/letter/1/0ea827/32.png) [@111](https://forum.opennebula.io/u/111)\
**Post date:** [June 15, 2015, 7:35am UTC](https://forum.opennebula.io/t/attach-disk-to-vm-failed/874/1 "2015-06-15T07:35:33Z")

</div>

I use onevm disk-attach 19 --image 4 cmd line attach success, but in the sunstone i attach the same image failed, here is the one log:

Mon Jun 15 15:18:37 2015 [Z0][VMM][D]: Message received: LOG I 20 Command execution fail: /var/tmp/one/vmm/kvm/attach\_disk ‘one-20’ ‘/var/lib/one//datastores/0/20/disk.2’ ‘hdc’ ‘2’ …

Mon Jun 15 15:18:37 2015 [Z0][VMM][D]: Message received: LOG E 20 attach\_disk: Command “virsh --connect qemu:///system attach-device one-20 /var/lib/one//datastores/0/20/disk.2.attach” failed: error: Failed to attach device from /var/lib/one//datastores/0/20/disk.2.attach

Mon Jun 15 15:18:37 2015 [Z0][VMM][D]: Message received: LOG I 20 error: unsupported configuration: disk bus ‘ide’ cannot be hotplugged.

Mon Jun 15 15:18:37 2015 [Z0][VMM][D]: Message received: LOG E 20 Could not attach /var/lib/one//datastores/0/20/disk.2 (hdc) to one-20

Mon Jun 15 15:18:37 2015 [Z0][VMM][D]: Message received: LOG I 20 ExitCode: 1

---

<div class="post-metadata">

**Author:** ![atodorov\_storpool](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/atodorov_storpool/32/5327_2.png) [@atodorov\_storpool](https://forum.opennebula.io/u/atodorov_storpool)\
**Post date:** [June 15, 2015, 11:15am UTC](https://forum.opennebula.io/t/attach-disk-to-vm-failed/874/2 "2015-06-15T11:15:32Z")

</div>

> [@111](#):
>
> Mon Jun 15 15:18:37 2015 [Z0][VMM][D]: Message received: LOG I 20 error: unsupported configuration: disk bus ‘ide’ cannot be hotplugged.

I found that by default OpenNebula is attaching images as “ide” drives with prefix “hd”. Try changing “DEVICE\_PREFIX” when attaching the image to “sd” or even “vd” and the attach command should succeed.

To change globally the default DEVICE\_PREFIX, edit a line in /etc/one/oned.conf:

> DEFAULT\_DEVICE\_PREFIX=“hd”

and restart the opennebula service

With hope this helps  
Anton Todorov
