Virtualbox can not add a machine: disk seems to be still attached to another machine

7,045

As I figured out, there is nothing to do with the hdparm command.

I didn't recovered the virtual machine, no matter what I did. So here is my workaround:

  1. I identified the latest snapshot file {92abc......}.vdi
  2. I cloned that with VBoxManage clonehd \{92abc......\}.vdi aaa.vdi
  3. I created a new virtual machine and attached aaa.vdi to the new machine.
  4. Booted up. Works just fine.
Share:
7,045

Related videos on Youtube

ceremcem
Author by

ceremcem

Electronics engineer, industrial software developer

Updated on September 18, 2022

Comments

  • ceremcem
    ceremcem over 1 year

    I had a virtual Debian server running on Debian host. After a reboot, the vdi images of the virtual machine simply vanished from configuration. I readded them, but it simply ignored the snapshots. I tried to manually delete the saved states, clone the virtual machine, change uuid of the disk... Nothing worked. Now, it refuses to add the virtual machine.

    Now, the problems comes to this point:

    Failed to open virtual machine located in /home/ceremcem/VirtualBox VMs/aktos-1-copy/aktos-1.vbox.
    
    Medium '/home/ceremcem/VirtualBox VMs/aktos-1-copy/aktos-1-disk1-2.vdi' cannot be closed because it is still attached to 1 virtual machines.
    
    Result Code: VBOX_E_OBJECT_IN_USE (0x80BB000C)
    Component: Medium
    Interface: IMedium {05f2bbb6-a3a6-4fb9-9b49-6d0dda7142ac}
    Callee: IVirtualBox {fafa4e17-1ee2-4905-a10e-fe7c18bf5554}
    Callee RC: NS_ERROR_FAILURE (0x80004005)
    

    I simply cleaned VirtualBox from my other virtal machines. There is no registered virtual machine in the gui.

    Only interesting thing I did in the virtual machine was that I tried to disable the write cache, so I run this code:

    hdparm -W 0 /dev/sda
    

    But the command didn't turn off the write cache. This is the only clue.