How to use the command 'vboxmanage-import' (with examples)
The vboxmanage-import
command is used to import a previously exported virtual machine (VM) in VirtualBox. It allows you to import the VM from an OVF or OVA file, set the name and configuration folder of the imported VM, register it in VirtualBox, perform a dry run to check the import, and set various properties for the imported VM such as guest OS type, memory, and number of CPUs.
Use case 1: Import a VM from an OVF or OVA file
Code:
VBoxManage import path/to/file.ovf
Motivation: This use case is used when you want to import a virtual machine that was previously exported as an OVF or OVA file.
Explanation: The import
command is followed by the path to the OVF or OVA file that contains the exported virtual machine. This command imports the VM into VirtualBox.
Example output:
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Use case 2: Set the name of the imported VM
Code:
VBoxManage import path/to/file.ovf --name vm_name
Motivation: This use case is used when you want to set a specific name for the imported VM instead of using the default name.
Explanation: The --name
option is used to specify the name of the imported VM. In the example command, replace vm_name
with the desired name.
Example output:
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Use case 3: Indicate the folder where the configuration of the imported VM will be stored
Code:
VBoxManage import path/to/file.ovf --basefolder path/to/directory
Motivation: This use case is used when you want to specify a custom folder where the configuration of the imported VM will be stored.
Explanation: The --basefolder
option is used to indicate the folder where the configuration of the imported VM will be stored. In the example command, replace path/to/directory
with the desired folder path.
Example output:
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Use case 4: Register the imported VM in VirtualBox
Code:
VBoxManage import path/to/file.ovf --register
Motivation: This use case is used when you want to register the imported VM in VirtualBox.
Explanation: The --register
option is used to register the imported VM in VirtualBox. This allows it to be managed and run as a virtual machine.
Example output:
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Use case 5: Perform a dry run to check the import without actually importing
Code:
VBoxManage import path/to/file.ovf --dry-run
Motivation: This use case is used when you want to perform a dry run to check the import process without actually importing the VM.
Explanation: The --dry-run
option is used to perform a dry run of the import process. This allows you to see what actions would be taken during the import without actually importing the VM.
Example output:
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Use case 6: Set the guest OS type for the imported VM
Code:
VBoxManage import path/to/file.ovf --ostype=ostype
Motivation: This use case is used when you want to set the guest OS type for the imported VM.
Explanation: The --ostype
option is used to specify the guest OS type for the imported VM. You can find the available OS types by running the VBoxManage list ostypes
command. Replace ostype
in the example command with the desired guest OS type.
Example output:
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Use case 7: Set the memory for the imported VM
Code:
VBoxManage import path/to/file.ovf --memory=1
Motivation: This use case is used when you want to set the memory allocation for the imported VM.
Explanation: The --memory
option is used to set the memory (in megabytes) for the imported VM. Replace 1
in the example command with the desired memory allocation in megabytes.
Example output:
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Use case 8: Set the number of CPUs for the imported VM
Code:
VBoxManage import path/to/file.ovf --cpus=1
Motivation: This use case is used when you want to set the number of CPUs for the imported VM.
Explanation: The --cpus
option is used to set the number of CPUs for the imported VM. In the example command, replace 1
with the desired number of CPUs.
Example output:
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Conclusion:
The vboxmanage-import
command provides several use cases for importing a previously exported virtual machine in VirtualBox. These use cases allow you to customize the import process by setting the VM name, configuration folder, guest OS type, memory, and number of CPUs. The command also allows you to perform a dry run to check the import without actually importing the VM.