Alfonso Baqueiro Bernal
Saturday Oct 3, 2020

Virtualization with VirtualBox

list commands

list information about the host system
VBoxManage list hostinfo
Host Information:

Host time: 2020-09-27T08:49:02.829000000Z
Processor online count: 4
Processor count: 4
Processor online core count: 2
Processor core count: 2
Processor supports HW virtualization: yes
Processor supports PAE: yes
Processor supports long mode: yes
Processor supports nested paging: yes
Processor#0 speed: 2700 MHz
Processor#0 description: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Processor#1 speed: 2700 MHz
Processor#1 description: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Processor#2 speed: 2700 MHz
Processor#2 description: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Processor#3 speed: 2700 MHz
Processor#3 description: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Memory size: 8192 MByte
Memory available: 2191 MByte
Operating system: Darwin
Operating system version: 15.6.0
list information about emulation ranges and other info
VBoxManage list systemproperties
API version:                     5_1
Minimum guest RAM size:          4 Megabytes
Maximum guest RAM size:          2097152 Megabytes
Minimum video RAM size:          0 Megabytes
Maximum video RAM size:          256 Megabytes
Maximum guest monitor count:     64
Minimum guest CPU count:         1
Maximum guest CPU count:         32
Virtual disk limit (info):       2199022206976 Bytes
Maximum Serial Port count:       4
Maximum Parallel Port count:     2
Maximum Boot Position:           4
Maximum PIIX3 Network Adapter count:   8
Maximum ICH9 Network Adapter count:   36
Maximum PIIX3 IDE Controllers:   1
Maximum ICH9 IDE Controllers:    1
Maximum IDE Port count:          2
Maximum Devices per IDE Port:    2
Maximum PIIX3 SATA Controllers:  1
Maximum ICH9 SATA Controllers:   8
Maximum SATA Port count:         30
Maximum Devices per SATA Port:   1
Maximum PIIX3 SCSI Controllers:  1
Maximum ICH9 SCSI Controllers:   8
Maximum SCSI Port count:         16
Maximum Devices per SCSI Port:   1
Maximum SAS PIIX3 Controllers:   1
Maximum SAS ICH9 Controllers:    8
Maximum SAS Port count:          255
Maximum Devices per SAS Port:    1
Maximum PIIX3 Floppy Controllers:1
Maximum ICH9 Floppy Controllers: 1
Maximum Floppy Port count:       1
Maximum Devices per Floppy Port: 2
Default machine folder:          /Users/abaqueiro/VirtualBox VMs
Raw-mode Supported:              no
Exclusive HW virtualization use: off
Default hard disk format:        VDI
VRDE auth library:               VBoxAuth
Webservice auth. library:        VBoxAuth
Remote desktop ExtPack:
Log history count:               3
Default frontend:
Default audio driver:            CoreAudio
Autostart database path:
Default Guest Additions ISO:     /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso
Logging Level:                   all
list operating system available types
VBoxManage list ostypes
ID:          Other
Description: Other/Unknown
Family ID:   Other
Family Desc: Other
64 bit:      false

ID:          Other_64
Description: Other/Unknown (64-bit)
Family ID:   Other
Family Desc: Other
64 bit:      true

ID:          Windows31
Description: Windows 3.1
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          Windows95
Description: Windows 95
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          Windows98
Description: Windows 98
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          WindowsMe
Description: Windows ME
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          WindowsNT4
Description: Windows NT 4
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          Windows2000
Description: Windows 2000
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          WindowsXP
Description: Windows XP (32-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          WindowsXP_64
Description: Windows XP (64-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      true

ID:          Windows2003
Description: Windows 2003 (32-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          Windows2003_64
Description: Windows 2003 (64-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      true

ID:          WindowsVista
Description: Windows Vista (32-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          WindowsVista_64
Description: Windows Vista (64-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      true

ID:          Windows2008
Description: Windows 2008 (32-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          Windows2008_64
Description: Windows 2008 (64-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      true

ID:          Windows7
Description: Windows 7 (32-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          Windows7_64
Description: Windows 7 (64-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      true

ID:          Windows8
Description: Windows 8 (32-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          Windows8_64
Description: Windows 8 (64-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      true

ID:          Windows81
Description: Windows 8.1 (32-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          Windows81_64
Description: Windows 8.1 (64-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      true

ID:          Windows2012_64
Description: Windows 2012 (64-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      true

ID:          Windows10
Description: Windows 10 (32-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          Windows10_64
Description: Windows 10 (64-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      true

ID:          WindowsNT
Description: Other Windows (32-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      false

ID:          WindowsNT_64
Description: Other Windows (64-bit)
Family ID:   Windows
Family Desc: Microsoft Windows
64 bit:      true

ID:          Linux22
Description: Linux 2.2
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          Linux24
Description: Linux 2.4 (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          Linux24_64
Description: Linux 2.4 (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          Linux26
Description: Linux 2.6 / 3.x / 4.x (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          Linux26_64
Description: Linux 2.6 / 3.x / 4.x (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          ArchLinux
Description: Arch Linux (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          ArchLinux_64
Description: Arch Linux (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          Debian
Description: Debian (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          Debian_64
Description: Debian (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          OpenSUSE
Description: openSUSE (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          OpenSUSE_64
Description: openSUSE (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          Fedora
Description: Fedora (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          Fedora_64
Description: Fedora (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          Gentoo
Description: Gentoo (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          Gentoo_64
Description: Gentoo (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          Mandriva
Description: Mandriva (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          Mandriva_64
Description: Mandriva (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          RedHat
Description: Red Hat (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          RedHat_64
Description: Red Hat (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          Turbolinux
Description: Turbolinux (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          Turbolinux_64
Description: Turbolinux (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          Ubuntu
Description: Ubuntu (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          Ubuntu_64
Description: Ubuntu (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          Xandros
Description: Xandros (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          Xandros_64
Description: Xandros (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          Oracle
Description: Oracle (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          Oracle_64
Description: Oracle (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          Linux
Description: Other Linux (32-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          Linux_64
Description: Other Linux (64-bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true

ID:          Solaris
Description: Oracle Solaris 10 5/09 and earlier (32-bit)
Family ID:   Solaris
Family Desc: Solaris
64 bit:      false

ID:          Solaris_64
Description: Oracle Solaris 10 5/09 and earlier (64-bit)
Family ID:   Solaris
Family Desc: Solaris
64 bit:      true

ID:          OpenSolaris
Description: Oracle Solaris 10 10/09 and later (32-bit)
Family ID:   Solaris
Family Desc: Solaris
64 bit:      false

ID:          OpenSolaris_64
Description: Oracle Solaris 10 10/09 and later (64-bit)
Family ID:   Solaris
Family Desc: Solaris
64 bit:      true

ID:          Solaris11_64
Description: Oracle Solaris 11 (64-bit)
Family ID:   Solaris
Family Desc: Solaris
64 bit:      true

ID:          FreeBSD
Description: FreeBSD (32-bit)
Family ID:   BSD
Family Desc: BSD
64 bit:      false

ID:          FreeBSD_64
Description: FreeBSD (64-bit)
Family ID:   BSD
Family Desc: BSD
64 bit:      true

ID:          OpenBSD
Description: OpenBSD (32-bit)
Family ID:   BSD
Family Desc: BSD
64 bit:      false

ID:          OpenBSD_64
Description: OpenBSD (64-bit)
Family ID:   BSD
Family Desc: BSD
64 bit:      true

ID:          NetBSD
Description: NetBSD (32-bit)
Family ID:   BSD
Family Desc: BSD
64 bit:      false

ID:          NetBSD_64
Description: NetBSD (64-bit)
Family ID:   BSD
Family Desc: BSD
64 bit:      true

ID:          OS2Warp3
Description: OS/2 Warp 3
Family ID:   OS2
Family Desc: IBM OS/2
64 bit:      false

ID:          OS2Warp4
Description: OS/2 Warp 4
Family ID:   OS2
Family Desc: IBM OS/2
64 bit:      false

ID:          OS2Warp45
Description: OS/2 Warp 4.5
Family ID:   OS2
Family Desc: IBM OS/2
64 bit:      false

ID:          OS2eCS
Description: eComStation
Family ID:   OS2
Family Desc: IBM OS/2
64 bit:      false

ID:          OS21x
Description: OS/2 1.x
Family ID:   OS2
Family Desc: IBM OS/2
64 bit:      false

ID:          OS2
Description: Other OS/2
Family ID:   OS2
Family Desc: IBM OS/2
64 bit:      false

ID:          MacOS
Description: Mac OS X (32-bit)
Family ID:   MacOS
Family Desc: Mac OS X
64 bit:      false

ID:          MacOS_64
Description: Mac OS X (64-bit)
Family ID:   MacOS
Family Desc: Mac OS X
64 bit:      true

ID:          MacOS106
Description: Mac OS X 10.6 Snow Leopard (32-bit)
Family ID:   MacOS
Family Desc: Mac OS X
64 bit:      false

ID:          MacOS106_64
Description: Mac OS X 10.6 Snow Leopard (64-bit)
Family ID:   MacOS
Family Desc: Mac OS X
64 bit:      true

ID:          MacOS107_64
Description: Mac OS X 10.7 Lion (64-bit)
Family ID:   MacOS
Family Desc: Mac OS X
64 bit:      true

ID:          MacOS108_64
Description: Mac OS X 10.8 Mountain Lion (64-bit)
Family ID:   MacOS
Family Desc: Mac OS X
64 bit:      true

ID:          MacOS109_64
Description: Mac OS X 10.9 Mavericks (64-bit)
Family ID:   MacOS
Family Desc: Mac OS X
64 bit:      true

ID:          MacOS1010_64
Description: Mac OS X 10.10 Yosemite (64-bit)
Family ID:   MacOS
Family Desc: Mac OS X
64 bit:      true

ID:          MacOS1011_64
Description: Mac OS X 10.11 El Capitan (64-bit)
Family ID:   MacOS
Family Desc: Mac OS X
64 bit:      true

ID:          DOS
Description: DOS
Family ID:   Other
Family Desc: Other
64 bit:      false

ID:          Netware
Description: Netware
Family ID:   Other
Family Desc: Other
64 bit:      false

ID:          L4
Description: L4
Family ID:   Other
Family Desc: Other
64 bit:      false

ID:          QNX
Description: QNX
Family ID:   Other
Family Desc: Other
64 bit:      false

ID:          JRockitVE
Description: JRockitVE
Family ID:   Other
Family Desc: Other
64 bit:      false

ID:          VBoxBS_64
Description: VirtualBox Bootsector Test (64-bit)
Family ID:   Other
Family Desc: Other
64 bit:      true
list virtual machines
VBoxManage list vms
list virtual machines actually running
VBoxManage list runningvms
list virtual hard disks
VBoxManage list hdds

create and run a virtual machine

create a VM description
VBoxManage createvm --name $VM_NAME --ostype $OS_TYPE --basefolder $BASE_PATH

createvm only creates the .vbox xml description file within the base folder
You need to register it for using list or modifyvm or other commands

register the vm description
VBoxManage registervm $FILE.vbox
show VM information
VBoxManage showvminfo NAME
Name:            debian-10-amd64
Groups:          /
Guest OS:        Debian (64-bit)
UUID:            e9e883a7-0df6-477c-9faa-2139ca370456
Config file:     /Users/abaqueiro/vm/debian-10-amd64/debian-10-amd64.vbox
Snapshot folder: /Users/abaqueiro/vm/debian-10-amd64/Snapshots
Log folder:      /Users/abaqueiro/vm/debian-10-amd64/Logs
Hardware UUID:   e9e883a7-0df6-477c-9faa-2139ca370456
Memory size:     128MB
Page Fusion:     off
VRAM size:       8MB
CPU exec cap:    100%
HPET:            off
Chipset:         piix3
Firmware:        BIOS
Number of CPUs:  1
PAE:             on
Long Mode:       on
Triple Fault Reset: off
APIC:            on
X2APIC:          on
CPUID Portability Level: 0
CPUID overrides: None
Boot menu mode:  message and menu
Boot Device (1): Floppy
Boot Device (2): DVD
Boot Device (3): HardDisk
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          on
BIOS APIC mode:  APIC
Time offset:     0ms
RTC:             local time
Hardw. virt.ext: on
Nested Paging:   on
Large Pages:     on
VT-x VPID:       on
VT-x unr. exec.: on
Paravirt. Provider: Default
Effective Paravirt. Provider: KVM
State:           powered off (since 2020-09-27T05:27:19.000000000)
Monitor count:   1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address:
Teleporter Password:
Tracing Enabled: off
Allow Tracing to Access VM: off
Tracing Configuration:
Autostart Enabled: off
Autostart Delay: 0
Default Frontend:
NIC 1:           MAC: 080027BBD91E, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings:  MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
Pointing Device: PS/2 Mouse
Keyboard Device: PS/2 Keyboard
UART 1:          disabled
UART 2:          disabled
UART 3:          disabled
UART 4:          disabled
LPT 1:           disabled
LPT 2:           disabled
Audio:           enabled (Driver: CoreAudio, Controller: AC97, Codec: STAC9700)
Clipboard Mode:  disabled
Drag and drop Mode: disabled
VRDE:            disabled
USB:             disabled
EHCI:            disabled
XHCI:            disabled

USB Device Filters:



Bandwidth groups:  

Shared folders:  

Video capturing:    not active
Capture screens:    0
Capture file:       /Users/abaqueiro/vm/debian-10-amd64/debian-10-amd64.webm
Capture dimensions: 1024x768
Capture rate:       512 kbps
Capture FPS:        25

Guest:

Configured memory balloon size:      0 MB

As you can see the virtual machine is created with minimun specs and NAT networking without any storage attached

run virtual machine
VBoxManage startvm $NAME

of course it will not boot because does not have storage attached, so we need to stop it

send poweroff signal to VM
VBoxManage controlvm $NAME acpipowerbutton
turn off VM equivalent to pulling the power cable
VBoxManage controlvm $NAME poweroff
reset VM
VBoxManage controlvm $NAME reset

run only VM without screen window

start VM headless
VBoxManage startvm $NAME --type headless
activate RDP server for being able to have access to virtual screen using RemoteDesktop client
VBoxManage modifyvm $NAME --vrde on
test VRDE was activated
VBoxManage showvminfo $NAME | grep -i vrde
VRDE:                        enabled (Address 0.0.0.0, Ports 3389, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
VRDE property               : TCP/Ports  = "3389"
VRDE property               : TCP/Address = 
VRDE property               : VideoChannel/Enabled = 
VRDE property               : VideoChannel/Quality = 
VRDE property               : VideoChannel/DownscaleProtection = 
VRDE property               : Client/DisableDisplay = 
VRDE property               : Client/DisableInput = 
VRDE property               : Client/DisableAudio = 
VRDE property               : Client/DisableUSB = 
VRDE property               : Client/DisableClipboard = 
VRDE property               : Client/DisableUpstreamAudio = 
VRDE property               : Client/DisableRDPDR = 
VRDE property               : H3DRedirect/Enabled = 
VRDE property               : Security/Method = 
VRDE property               : Security/ServerCertificate = 
VRDE property               : Security/ServerPrivateKey = 
VRDE property               : Security/CACertificate = 
VRDE property               : Audio/RateCorrectionMode = 
VRDE property               : Audio/LogPath = 
to enable VRDP service, VirtualBox Extension Pack must be installed.

defining CPU and Memory capacity

setting number of CPUs
VBoxManage modifyvm $NAME --cpus 2
setting RAM size
VBoxManage modifyvm $NAME --memory 512
setting Video RAM size
VBoxManage modifyvm $NAME --vram 12
VRAM required according to desired resolution
Display Resolution Standard Width, in Pixels Height, in Pixels 1-Monitor Overhead 2-Monitor Overhead 3-Monitor Overhead 4-Monitor Overhead
VGA 640 480 1.20MB 3.20MB 4.80MB 5.60MB
WXGA 1280 800 4.00MB 12.50MB 18.75MB 25.00MB
1080p 1920 1080 8.00MB 25.40MB 38.00MB 50.60MB
WQXGA 2560 1600 16.00MB 60.00MB 84.80MB 109.60MB
UHD (4K) 3840 2160 32.00MB 78.00MB 124.00MB Not supported
Note: this values were taken from VMWare documentation, VirtualBox values may be a little diferent in practice

Setting up networking

By default NAT is used, if you want a independent network HW emulation bridged network is a must!

bridging network
VBoxManage modifyvm $NAME --nic1 bridged --bridgeadapter1 $DEV
natting network again
VBoxManage modifyvm $NAME --nic1 nat

provisioning storage

add IDE Controller
VBoxManage storagectl $NAME --name "IDE1" --add ide
lines added to vminfo:
Storage Controller Name (0):            IDE1
Storage Controller Type (0):            PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  2
Storage Controller Port Count (0):      2
Storage Controller Bootable (0):        on
Remove IDE Controller
VBoxManage storagectl $NAME --name "IDE1" --remove
add a DVD drive to the IDE controller, no disk inserted
VBoxManage storageattach $NAME --storagectl "IDE1" --port 0 --device 0 --type dvddrive --medium emptydrive
showvminfo aditional lines:
IDE1 (0, 0): Empty
load dvd iso-image into dvd 0
VBoxManage storageattach $NAME --storagectl "IDE1" --port 0 --device 0 --type dvddrive --medium $PATH_ISO_FILE
showvminfo looks like:
IDE1 (0, 0): /Users/abaqueiro/iso-images/debian-10.5.0-amd64-netinst.iso
add sata controller
VBoxManage storagectl $NAME --name "SATA1" --add sata --bootable on
can have up to 30 disks
Storage Controller Name (1):            SATA1
Storage Controller Type (1):            IntelAhci
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1):  30
Storage Controller Port Count (1):      30
Storage Controller Bootable (1):        on
create Virtual HD
VBoxManage createmedium disk --filename $PATH_TO_FILE --size $SIZE_MB --format VDI --variant Standard
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: 0cb8dd99-a4ad-4f0d-893c-01ad4dcbd3ad
show HD file information
VBoxManage showmediuminfo $PATH_TO_FILE
UUID:           0cb8dd99-a4ad-4f0d-893c-01ad4dcbd3ad
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       /Users/abaqueiro/vm/debian-10-amd64/debian-10-amd64.vdi
Storage format: VDI
Format variant: dynamic default
Capacity:       4096 MBytes
Size on disk:   2 MBytes
Encryption:     disabled
add Virtual HD to storage
VBoxManage storageattach $NAME --storagectl SATA1 --port 0 --device 0 --type hdd --medium $PATH_TO_FILE
SATA1 (0, 0): /Users/abaqueiro/vm/debian-10-amd64/debian-10-amd64.vdi (UUID: 0cb8dd99-a4ad-4f0d-893c-01ad4dcbd3ad)
change UUID de disco virtual
VBoxManage internalcommands sethduuid $VIRTUAL_DISK_FILE
UUID changed to: d83c8c75-19a5-44de-a33c-4a80d019f2ea
clone Virtual Disk
VBoxManage clonehd $SOURCE_VD_FILE $DEST_VD_FILE --format $VD_FORMAT --variant FORMAT_VARIANT
ej
VBoxManage clonehd in.vdi out.vdi --format VDI --variant Standard
Clone medium created in format 'VDI'. UUID: 83a1bd38-50ea-434d-909c-00a97c802682
clone

Time settings

Set real time clock in VM to UTC
VBoxManage modifyvm $NAME --rtcuseutc on
Set real time clock in VM to Local Time
VBoxManage modifyvm $NAME --rtcuseutc off

References:

  1. A good tutorial for VirtualBox CLI interface
  2. VBoxManage documentation