disk unlock for closemedium

This is for discussing general topics about how to use VirtualBox.
Post Reply
klevchenko
Posts: 6
Joined: 16. May 2020, 09:47

disk unlock for closemedium

Post by klevchenko »

when use VBoxManage clonehdd <img> <new path> it will lock disk
and after VBoxManage closemedium <img>

Code: Select all

Failed to close the disk image file /home/klevchenko/vbox_imgs/Ubuntu 16.04.6 (64bit).vmdk.

Medium '/home/klevchenko/vbox_imgs/Ubuntu 16.04.6 (64bit).vmdk' is locked for reading by another task.

Result Code: VBOX_E_INVALID_OBJECT_STATE (0x80BB0007)
Component: MediumWrap
Interface: IMedium {ad47ad09-787b-44ab-b343-a082a3f2dfb1}
so how can i unlock it to clone while first clone is running
if i remove

Code: Select all

<HardDisk uuid="{60cda39c-eb9d-43b8-b43f-b206c851fc4b}" location="/home/klevchenko/vbox_imgs/Ubuntu 16.04.6 (64bit).vmdk" format="VMDK" type="Normal"/>
from

Code: Select all

 .config/VirtualBox/VirtualBox.xml
it allow to clone hdd multiple times

but i want to use VBoxManage command if it pissible
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: disk unlock for closemedium

Post by scottgus1 »

klevchenko wrote:Medium '/home/klevchenko/vbox_imgs/Ubuntu 16.04.6 (64bit).vmdk' is locked for reading by another task.
...
so how can i unlock it to clone while first clone is running
Are you trying to clone the disk more than once, and start the second clone process before the first clone process is finished?
klevchenko
Posts: 6
Joined: 16. May 2020, 09:47

Re: disk unlock for closemedium

Post by klevchenko »

Are you trying to clone the disk more than once, and start the second clone process before the first clone process is finished?
yes and with deleting data about disk from

Code: Select all

.config/VirtualBox/VirtualBox.xml
it can be done
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: disk unlock for closemedium

Post by scottgus1 »

I don't know if there is a legitimate way to do what you're doing within Virtualbox. There is a warning at the top of Virtualbox's XML files:
** DO NOT EDIT THIS FILE.
** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
As a thought, if you copy the shut-down guest's disk file in the host OS, you can then clone the copy of the disk file outside Virtualbox's knowledge, so Virtualbox might not lock the drive file for multiple simultaneous clones. Or Mpack's CloneVDI might do the clone.
Post Reply