# Can't detach disk

**URL:** <https://forum.opennebula.io/t/cant-detach-disk/4272>\
**Category:** Product Support\
**Created:** [May 12, 2017, 9:23am UTC](https://forum.opennebula.io/t/cant-detach-disk/4272 "2017-05-12T09:23:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![francisco.lopez](https://avatars.discourse-cdn.com/v4/letter/f/439d5e/32.png) [@francisco.lopez](https://forum.opennebula.io/u/francisco.lopez)\
**Post date:** [May 12, 2017, 9:23am UTC](https://forum.opennebula.io/t/cant-detach-disk/4272/1 "2017-05-12T09:23:09Z")

</div>

Hello everyone,

I have installed opennebula and I can’t detach a disk form an instance that I have running. The VM has two disks attached, disk 0, a Debian ISO cd and disk 1,a 50GB volatile drive (where I installed Debian). The thing is that now that Debian is installed, I want to detach the CD ISO so the Debian OS that I installed can boot. So far it boots directly the CD ISO, not letting me detach it. I don’t get any errors, just a message saying “detaching”, then I refresh and it is as before. I tried to detach it via command line, and again, the command seems to execute with no errors, but when I list the disks I see the CD ISO still there. Could someone give me a hand with this?

Thanks a lot and regards

---

<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:** [May 12, 2017, 1:39pm UTC](https://forum.opennebula.io/t/cant-detach-disk/4272/2 "2017-05-12T13:39:40Z")

</div>

Hi,

You should check for clues what’s going on in the oned logfile `/var/log/one/oned.log` the reason for not detaching the disk should be logged there.

Best Regards,  
Anton Todorov

---

<div class="post-metadata">

**Author:** ![francisco.lopez](https://avatars.discourse-cdn.com/v4/letter/f/439d5e/32.png) [@francisco.lopez](https://forum.opennebula.io/u/francisco.lopez)\
**Post date:** [May 12, 2017, 1:50pm UTC](https://forum.opennebula.io/t/cant-detach-disk/4272/3 "2017-05-12T13:50:46Z")

</div>

Hello Anton,

Thanks for your answer. Here’s what the log says:

Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: LOG E 34 detach\_disk: Command “virsh --connect qemu:///system detach-disk --domain one-34 --target hda” failed: error: Failed to detach disk

Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: LOG I 34 error: Operation not supported: This type of disk cannot be hot unplugged

Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: LOG E 34 Could not detach hda from one-34

Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: LOG I 34 ExitCode: 1

Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: LOG I 34 Failed to execute virtualization driver operation: detach\_disk.

Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: DETACHDISK FAILURE 34 Could not detach hda from one-34

Any clues why this disk cannot be hot unplugged? Is there another way of unplugging? I’ve tried shutting the machine down and when doing so, the detach option dissapears

---

<div class="post-metadata">

**Author:** ![francisco.lopez](https://avatars.discourse-cdn.com/v4/letter/f/439d5e/32.png) [@francisco.lopez](https://forum.opennebula.io/u/francisco.lopez)\
**Post date:** [May 12, 2017, 2:08pm UTC](https://forum.opennebula.io/t/cant-detach-disk/4272/4 "2017-05-12T14:08:01Z")

</div>

I also tried this, with same results:

virsh --connect qemu:///system detach-disk --domain one-34 --target hda

---

<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:** [May 12, 2017, 2:12pm UTC](https://forum.opennebula.io/t/cant-detach-disk/4272/5 "2017-05-12T14:12:44Z")

</div>

Hi Francisco,

> [@francisco.lopez](#):
>
> Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: LOG E 34 detach\_disk: Command “virsh --connect qemu:///system detach-disk --domain one-34 --target hda” failed: error: Failed to detach disk
> 
> Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: LOG I 34 error: Operation not supported: This type of disk cannot be hot unplugged

The “hd” prefiexd devices are using virtio-ide interface which hasn’t hotplug option. You should be able to detach the disk while the VM is powered off though.

Best Regards,  
Anton Todorov

---

<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:** [May 12, 2017, 2:15pm UTC](https://forum.opennebula.io/t/cant-detach-disk/4272/6 "2017-05-12T14:15:15Z")

</div>

Also you can change the boot order when the VM is in powered-off state: VM details -\> Conf -\> Update Configuration(green button)

Best,  
Anton

---

<div class="post-metadata">

**Author:** ![francisco.lopez](https://avatars.discourse-cdn.com/v4/letter/f/439d5e/32.png) [@francisco.lopez](https://forum.opennebula.io/u/francisco.lopez)\
**Post date:** [May 12, 2017, 2:20pm UTC](https://forum.opennebula.io/t/cant-detach-disk/4272/7 "2017-05-12T14:20:33Z")

</div>

Hi Anton,

thanks a lot for your prompt answer. I shutdown the machine and went to update configuration, but then I get the following error:  
Configuration cannot be updated in status SHUTDOWN\_POWEROFF

Should I put it in the “Terminate” or “Undeploy” state rather that shutdown?

---

<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:** [May 12, 2017, 2:22pm UTC](https://forum.opennebula.io/t/cant-detach-disk/4272/8 "2017-05-12T14:22:48Z")

</div>

Hm, you should definitely can attach/detach ide disk in powered off state. For changing boot options like boot order ‘undeploy’ should be ok. Terminate will delete the VM.

Best,  
Anton

---

<div class="post-metadata">

**Author:** ![francisco.lopez](https://avatars.discourse-cdn.com/v4/letter/f/439d5e/32.png) [@francisco.lopez](https://forum.opennebula.io/u/francisco.lopez)\
**Post date:** [May 12, 2017, 2:22pm UTC](https://forum.opennebula.io/t/cant-detach-disk/4272/9 "2017-05-12T14:22:48Z")

</div>

I tried again, and this time the machine is in state Poweroff. I no longer get the error form before, although the changes don’t apply when checking afterwards. The boot order remains the same

---

<div class="post-metadata">

**Author:** ![francisco.lopez](https://avatars.discourse-cdn.com/v4/letter/f/439d5e/32.png) [@francisco.lopez](https://forum.opennebula.io/u/francisco.lopez)\
**Post date:** [May 12, 2017, 2:24pm UTC](https://forum.opennebula.io/t/cant-detach-disk/4272/10 "2017-05-12T14:24:54Z")

</div>

Instead of changing the order I removed the disk while Poweroff, and I can now boot correctly into my OS. Thanks a lot for the quick answers!

Francisco
