查看系统中正在运行的虚拟机:
user@MyServer:~$VBoxManage list runningvms "Ubuntu1010" {b066726c-8559-48f1-b998-fd7ad742e7ce}
关机
user@MyServer:~$VBoxManage controlvm Ubuntu1010 poweroff 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
poweroff 的兄弟姐妹们:
pause resume reset savestate acpipowerbutton acpisleepbutton
如果磁盘空间不够了, 那VBox4.0支持resize:
user@MyServer:~$VBoxManage modifyhd Ubuntu1010.vdi --resize 40000
clone一个虚拟机:
user@MyServer:~$VBoxManage clonehd Ubuntu1004.vdi destination.vdi
什么? 不想这么折腾了, 那删了吧:
user@MyServer:~$VBoxManage unregistervm Ubuntu1010 --delete
=======================
设置ssh端口转发:
user@MyServer:~$ VBoxManage setextradata "Ubuntu1004" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP user@MyServer:~$ VBoxManage setextradata "Ubuntu1004" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22 user@MyServer:~$ VBoxManage setextradata "Ubuntu1004" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 22222
错误记录:
user@MyServer:~$VBoxManage startvm Ubuntu1004 --type headless Waiting for the VM to power on... VBoxManage: error: Configuration error: Failed to get the "MAC" value (VERR_CFGM_VALUE_NOT_FOUND). VBoxManage: error: Unknown error creating VM (VERR_CFGM_VALUE_NOT_FOUND) VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component Console, interface IConsole, callee
可能因为原来设置过nic2, 还给nic2设置了端口转发, 后来删除了nic2, 却忘了把转发删除:
设置:
user@MyServer:~$ VBoxManage setextradata "Ubuntu1004" "VBoxInternal/Devices/pcnet/1/LUN#1/Config/guestssh/Protocol" TCP user@MyServer:~$ VBoxManage setextradata "Ubuntu1004" "VBoxInternal/Devices/pcnet/1/LUN#1/Config/guestssh/GuestPort" 22 user@MyServer:~$ VBoxManage setextradata "Ubuntu1004" "VBoxInternal/Devices/pcnet/1/LUN#1/Config/guestssh/HostPort" 22222
删除:
user@MyServer:~$ VBoxManage setextradata "Ubuntu1004" "VBoxInternal/Devices/pcnet/1/LUN#1/Config/guestssh/Protocol" user@MyServer:~$ VBoxManage setextradata "Ubuntu1004" "VBoxInternal/Devices/pcnet/1/LUN#1/Config/guestssh/GuestPort" user@MyServer:~$ VBoxManage setextradata "Ubuntu1004" "VBoxInternal/Devices/pcnet/1/LUN#1/Config/guestssh/HostPort"
升级:
如果升级遇到错误信息:
VirtualBox is currently running. Please close it and try again...
那就找到虚拟机进程, 然后杀掉
ps -aux | grep virtualbox root 12909 0.0 0.0 7624 920 pts/0 S+ 12:30 0:00 grep virtualbox user 13438 0.0 0.0 167956 2628 ? Sl May08 13:14 /usr/lib/virtualbox/VBoxSVC --auto-shutdown