Opened 10 years ago
Last modified 8 years ago
#14724 new enhancement
Need way to move virtual-disk files of running VM
Reported by: | Jim Avera | Owned by: | |
---|---|---|---|
Component: | VM control | Version: | VirtualBox 5.0.6 |
Keywords: | Cc: | anonymous1 | |
Guest type: | other | Host type: | Linux |
Description
This is an enhancement request to permit virtual disk files to be moved while they are in use by a (paused) VM.
If an out-of-disk condition occurs, VBox very nicely pauses the VM and pops up a message so you can fix the problem and resume. However, it continues to hold the virtual disk (including snapshot) files open, so even if they are moved and replaced by symlinks, no disk space can be freed up. If the VM was running in a dedicated partition, i.e., there is nothing else to move or delete besides VM's files, then there is no possible recovery without loosing VM state; VBox won't close the old files until the VM is shut down, and it and it can't save the VM state if disk is full.
Following are a couple of suggestions, one basic and the other fancy:
Method A (Basic): When a VM is "paused", close all the VM's files, at least the virtual disks; re-open them only when the VM is resumed.
This would let you manually relocate a virtual disk and replace it with a symlink while the VM is paused. Using the symlink would be necessary because the .vbox file still could not be edited while VBox is running.
Method B (Fancy): Provide a comprehensive command to move a virtual disk, updating VirtualBox.xml or the VM's .vbox file as appropriate. For example
VBoxManage modifyvm <vmident> --movemedium <uuid|filename> /destination/folder/ VBoxManage modifyvm <vmident> --movesnap <snapid|filename> /destination/folder/
This would
- pause all VMs using the specified virtual disk *if not already paused*
(and make them close the underlying files, just as in the simpler method above);
- move the file,
- update and rewrite VirtualBox.xml or the VM's .vbox file with the new path;
- resume VMs paused in step 1 (but not VMs which were already paused)
New CC list: anonymous1