LinuxCommandLibrary

vboxmanage-movevm

Move a virtual machine to another location

TLDR

Move the specified virtual machine to the current location

$ VBoxManage movevm [vm_name]
copy

Specify the new location (full or relative pathname) of the virtual machine
$ VBoxManage movevm [vm_name] --folder [path/to/new_location]
copy

SYNOPSIS

vboxmanage movevm <uuid|name> --target-folder <folder>

PARAMETERS

<uuid|name>
    The unique identifier (UUID) or the registered name of the virtual machine to be moved.

--target-folder <folder>
    Specifies the absolute path to the new directory where the VM's files should be relocated. This directory must exist and be writable by the user running the command.

DESCRIPTION

vboxmanage movevm is a subcommand of the vboxmanage utility, which is the command-line interface for Oracle VirtualBox. This specific command allows you to relocate a virtual machine's entire set of files, including its configuration file (.vbox), its virtual disk images (.vdi, .vmdk, etc.), and other associated data, from its current storage location on the host file system to a new specified directory.

It's crucial that the virtual machine is powered off before attempting this operation, as moving files while the VM is running can lead to data corruption. The command handles the internal updates required within VirtualBox's registry to reflect the new paths, ensuring that VirtualBox can still find and manage the VM after the move. This command is particularly useful for organizing storage, migrating VMs to faster disks, or consolidating VM files.

CAVEATS

  • VM State: The virtual machine must be powered off (Powered Off state) before executing this command. Attempting to move a running or saved VM will result in an error.
  • Disk Space: Ensure the target location has sufficient free disk space to accommodate all the VM's files.
  • Permissions: The user executing the command must have appropriate read and write permissions to both the source and target directories.
  • Snapshots: The command handles moving snapshots associated with the VM, but it's always good practice to back up critical VMs before major operations.
  • Shared Folders/USB Filters: While the VM files are moved, any host-specific configurations like shared folders or USB device filters might need re-checking if paths or devices change.

FILES MOVED

This command moves the VM's configuration file (.vbox), all associated virtual disk images (.vdi, .vmdk, .vhd, etc.), snapshot files, log files, and other related data.

INTERNAL UPDATES

Beyond just moving files, vboxmanage movevm also updates VirtualBox's internal registry and the VM's configuration file to reflect the new paths for the virtual disks and other components, ensuring the VM remains functional without manual path adjustments.

NO COPY OPTION

There is no built-in --copy option; movevm performs a move operation, which means the files are physically transferred to the new location and deleted from the old. If you need a copy, you would typically clone the VM or manually copy and then register.

HISTORY

VirtualBox, initially developed by Innotek GmbH, was later acquired by Sun Microsystems in 2008 and subsequently by Oracle Corporation in 2010. The vboxmanage utility has been a core component of VirtualBox since its early versions, providing comprehensive command-line control over all aspects of VM management. The movevm subcommand was introduced to streamline the process of relocating VM files, automating the complex task of updating internal configuration files and the VirtualBox registry, which would otherwise be a manual and error-prone process. Its existence reflects the need for robust VM lifecycle management tools in virtualized environments.

SEE ALSO

vboxmanage(1), vboxmanage registervm(1), vboxmanage unregistervm(1), mv(1)

Copied to clipboard