Skip to content
Bots!
Bots!
  • About
    • Myself
    • আমার দোয়া
  • Bookmarks
    • Bookmarks
    • My OCI Bookmarks
    • Useful Proxmox Commands & Links
    • Learning Nano
    • Useful Sites
    • Useful Virtualbox Command
    • Useful MySQL Command
    • Useful Linux Command
    • BTT-CAS
  • Resources
    • Webinar on Cloud Adoption for Project Managers
  • Photos
  • Videos
  • Downloads
Bots!

Useful Virtualbox Command

Log into your host server using ssh.

Get a list of all VMs.

$ VBoxManage list vms

Start a guest VM named mywiki with RDP enabled and listening on port 3390.

If you plan to run multiple guest VMs in headless mode with RDP enabled, you will need to choose a unique port for each to listen on. If you don’t specify a port, the default port is 3389.

$ nohup VBoxHeadless -s mywiki -v on -p 3390 &

Now if you want to check that your guest VM is among your running VMs

$ VBoxManage list runningvms

If you should need to connect to the console on that running VM named mywiki. Lets assume it’s IP address is 192.168.139.10. We are going to use rdesktop, which is a good RDP client found in most linux distros.

$ rdesktop -g 1024x768 -a 16 -5 192.168.139.10:3390 &

To view the properties of your VM use the showvminfo option. This is handy if you want to connect your RDP client to a running VM and you don’t remember which port your VM is listening on.

$ VBoxManage showvminfo mywiki Ok, now lets assume you have a rogue guest-

VM that want to shut-down and it is not responding to your request for a normal orderly shut-down.

You can power it off using-

$ VBoxManage contolvm mywiki poweroff

For details see virtualbox site-

https://www.virtualbox.org/manual/ch08.html

https://www.virtualbox.org/manual/ch08.html

$ vboxmanage import <file>.ova

https://www.virtualbox.org/manual/ch08.html

$ vboxmanage export <machine-name> -o <file>.ova

https://www.virtualbox.org/manual/ch08.html

$ vboxmanage clonevm <source-machine-name> --name <target-machine-name> --register

Check running process and kill in case VM got stuck

 ps -AF | grep V

Start Virtual machine

VBoxManage startvm "VM name" --type headless

For example:

VBoxManage startvm ubuservloc --type headless

Exporting and importing appliances

In the case you do your backups using some sort of shell script, VBoxManage export (followed by the virtual machine name, can help you get the job done. The following command will export the CentOS7 appliance to ~/VMexports/CentOS7.ova:

VBoxManage export CentOS7 --output ~/VMexports/CentOS7.ova

To import it (not surprisingly), we will use VBoxManage import:

VBoxManage import ~/VMexports/CentOS7.ova

Resize Virtual Disk Size

VBoxManage clonehd "source.vmdk" "cloned.vdi" --format vdi

VBoxManage modifyhd "cloned.vdi" --resize 51200

VBoxManage clonehd "cloned.vdi" "resized.vmdk" --format vmdk

Changing UUID in virtual disk

VBoxManage internalcommands sethduuid "/home/user/VirtualBox VMs/drupal/drupal.vhd"

List your VMS

First list your available Virtual Machines with the command VBoxManage list vms, I illustrate this on my own setup:

andrew@ilium~$ VBoxManage list vms
"Windows 8" {c4422acd-727b-45a0-9eef-65636bcde44d}
"Windows 10" {a8e262be-a032-4918-9085-63185318a979}
"Trusty Tahr Clean Copy" {c99bcf4b-9fea-4971-b190-425cb0b0cdeb}
"Xenial Xerus Clean Copy" {850122b9-c65f-425b-abb3-ffda68e159c6}
"Precise Pangolin Clean Copy" {169086e6-a3f4-42e7-8a89-63dcb273143f}
"Precise Pangolin Working Copy" {ff8312b6-cfae-4877-aa93-d71036d8882c}
"Xenial Xerus for MPlayer" {44902710-4368-4c06-9d24-3cb55328d31c}
"Xenial Xerus for vlc" {a62ad306-17d9-4ee3-8c1a-e4439c3b0e05}
"Xenial Xerus mingw64" {584d8513-6a16-49c7-b020-d657b93d5552}
"Trusty Tahr Working copy..." {433349e9-52eb-4066-bae7-623592871839}
"Xenial Xerus Working copy..." {dda23e74-cdb5-4c7d-8836-31be4129c02a}
andrew@ilium~$

Note: If you are unsure which VM is actually running you could use 

VBoxManage list runningvms

Start a VM:

The VBoxManage command and options that you are after to start a Virtual Machine are these:

startvm <uuid|vmname>...
 [--type gui|sdl|headless|separate]

So to start the “Trusty Tahr Clean Copy” VM in my example you would use:

VBoxManage startvm "Trusty Tahr Clean Copy" --type gui

Stop a VM:

To stop the VM you would again use VBoxManage but this time with controlvm option:

controlvm <uuid|vmname>
 pause|resume|reset|poweroff|savestate|

And in my example to close the “Trusty Tahr Clean Copy” VM the command would be:

VBoxManage controlvm "Trusty Tahr Clean Copy" savestate

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Myself…

Hi, I am Hasan T. Emdad Rumi, an IT Project Manager & Consultant, Virtualization & Cloud Savvyfrom Dhaka, Bangladesh. I have prior experience in managing numerous local and international projects in the area of Telco VAS & NMC, National Data Center & PKI Naitonal Root and CA Infrastructure. Also engaged with several Offshore Software Development Team.

Worked with Orascom Telecom-Banglalink, Network Elites as VAS partner, BTRC, BTT (Turkey) , Mango Teleservices Limited and Access to Informaiton (A2I-UNDP)

Currently working at Oracle Corporation as Principal Technology Solution and Cloud Architect.

You can reach me [h.t.emdad at gmail.com] and I will be delighted to exchange my views.

Tags

Apache Bind Cacti CentOS CentOS 6 CentOS 7 Debain Debian Debian 10 Debian 11 Debian 12 DKIM Docker endian icinga iptables Jitsi LAMP Letsencrypt Linux Munin MySQL Nagios Nextcloud NFS nginx pfsense php Postfix powerdns Proxmox RDP squid SSH SSL Ubuntu Ubuntu 16 Ubuntu 18 Ubuntu 20 Varnish virtualbox vpn Webmin XCP-NG zimbra

Topics

Recent Posts

  • Install Jitsi on Ubuntu 22.04 / 22.10 April 30, 2025
  • Key Lessons in life April 26, 2025
  • Create Proxmox Backup Server (PBS) on Debian 12 April 19, 2025
  • Add Physical Drive in Proxmox VM Guest April 19, 2025
  • Mount a drive permanently with fstab in Linux April 16, 2025
  • Proxmox 1:1 NAT routing March 30, 2025
  • Installation steps of WSL – Windows Subsystem for Linux March 8, 2025
  • Enabling Nested Virtualization In Proxmox March 8, 2025
  • How to Modify/Change console/SSH login banner for Proxmox Virtual Environment (Proxmox VE / PVE) March 3, 2025
  • Install Proxmox Backup Server on Debian 12 February 12, 2025

Archives

Top Posts & Pages

  • Install Jitsi on Ubuntu 22.04 / 22.10
©2025 Bots! | WordPress Theme by SuperbThemes