VirtualBox

Ubuntu Cloud Images on VirtualBox

Ubuntu Cloud Imagesopen in new window

sudo apt install cloud-image-utils
cat >user-data <<EOF
#cloud-config
password: ubuntu
chpasswd: { expire: False }
ssh_pwauth: True
EOF
cloud-localds user-data.iso user-data

and now you can login with:

  • username: ubuntu
  • password: ubuntu

Usage on Windows

Windows PATH

SET PATH=%PATH%;C:\Program Files\Oracle\VirtualBox

Convert VDI / VMDK / VHD

VBoxManage clonehd --format vdi "input.vmdk" "output.vdi"
VBoxManage clonehd --format vmdk "input.vhd" "output.vmdk"
VBoxManage convertfromraw --format VMDK "input.img" "output.vmdk"

Command to List Virtual Machines

VBoxManage list vms

List all running VMs

VBoxManage list runningvms

Start VirtualBox VM via command

VBoxManage startvm virtualmachine-name

Stop Virtual machine using command

VBoxManage controlvm virtualmachine-name poweroff

Resize virtual disk (resize in MB)

VBoxManage modifyhd "HDD.vdi" --resize 36000

D:\bin\vm.bat

@echo off

if "%1" == "up" (
	VBoxManage startvm vm-name --type headless
) else if "%1" == "halt" (
	VBoxManage controlvm vm-name acpipowerbutton
) else (
	echo "Unknown %1"
)
Last Updated:
Contributors: kelude