#file: docs/cheat-sheets/vbox/vbox-cheat-sheet.sh
# how-to start a vm without ui
VBoxManage startvm "vm-name" --type headless
# how-to start a vm with detachable ui ( no 3D acceleration )
VBoxManage startvm "vm-name" --type separate
# how-to save the current state of the vm
VBoxManage controlvm "vm_name" savestate
# how-to start a vm with ui
VBoxManage startvm "vm-name"
# how-to shutdown a vm
VBoxManage controlvm "vm_name" poweroff
# add port forwarding from host to guest
VBoxManage modifyvm "vm_name" --natpf1 "5001,tcp,,5001,,5001"
#how-to check network settings
VBoxManage showvminfo "vm_name" | grep NIC
:: how-to export all myy Virtual box vms in Windows in the current dir in cmd
for /f "tokens=1 delims= " %i in ('VBoxManage list vms') do VBoxManage export %i -o %i.ova
for f in $(VBoxManage list runningvms | awk -F\" '{print $2}'); do \
echo "$f:"; VBoxManage guestproperty enumerate "$f" | grep IP; done ;
#how-to resize the virtual disk
VBoxManage modifyhd "C:\Users\ysg\VirtualBox VMs\doc-pub-host\doc-pub-host-disk1.vmdk" --resize 20000
#you reserved too little space during installation ?! No problem resize the virtual disk :
VBoxManage clonehd "C:\Users\ysg\VirtualBox VMs\doc-pub-host\doc-pub-host-disk1.vmdk" "C:\Users\ysg\VirtualBox VMs\doc-pub-host\doc-pub-host-disk.vdi" --format vdi
VBoxManage modifyhd "C:\Users\ysg\VirtualBox VMs\doc-pub-host\doc-pub-host-disk.vdi" --resize 20480
VBoxManage guestproperty enumerate doc-pub-host | grep -i Net | grep -i ip
:: nok Add an IDE controller with a DVD drive attached, and the install ISO inserted into the drive:
VBoxManage storagectl lp_host --name "IDE" --add ide
:: ok
VBoxManage storageattach lp_host --storagectl "IDE" --port 0 --device 0 --type dvddrive --medium "C:\var\pckgs\gnu\Ubuntu\ubuntu-16.04.1-desktop-amd64.iso"
VBoxManage modifyvm %VM% --ioapic on
VBoxManage modifyvm %VM% --boot1 dvd --boot2 disk --boot3 none --boot4 none
VBoxManage modifyvm %VM% --memory 1024 --vram 128
VBoxManage modifyvm %VM% --nic1 bridged --bridgeadapter1 e1000g0
# how-to backup all my vms ?!
# no need to export to ova , just copy recursively the dir with the *.vbox , *.vdi files
# than add the machines via the UI , machine add , paste the path to the vbox file
# you might need to unregisster vhdds as follows:
vboxmanage closemedium disk '5a5b03ef-0d1e-4708-9c68-11f40b61940f' --delete
#
# ---------------------------------------------------------
# VersionHistory:
# ---------------------------------------------------------
# export version=1.2.0
# ---------------------------------------------------------
# 1.2.0 -- 2017-03-29 17:06:24 -- ysg -- backup instructios
# 1.1.0 -- 2016-12-01 08:42:59 -- ysg --
# 1.0.0 -- 2016-08-16 22:40:16 -- ysg --
# ---------------------------------------------------------
#eof file: docs/cheat-sheets/vbox/vbox-cheat-sheet.sh
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!