Virtualbox 命令行基本使用
1,创建虚拟机使用Vagrant模板创建虚拟机:https://blog.csdn.net/eyeofeagle/article/details/987397272,启动/停止虚拟机#2,启动/关闭,暂停/保存状态并休眠VBoxManage startvm<uuid|vmname>...[--type gui|sdl|headless|separate]
·
1,创建虚拟机
使用Vagrant模板创建虚拟机:https://blog.csdn.net/eyeofeagle/article/details/98739727
2,启动/停止虚拟机
#2,启动/关闭,暂停/保存状态并休眠
VBoxManage startvm <uuid|vmname>...
[--type gui|sdl|headless|separate]
[-E|--putenv <NAME>[=<VALUE>]]
VBoxManage controlvm <uuid|vmname>
pause|resume|reset|poweroff|savestate|
λ VBoxManage.exe controlvm c7-docker_default_1591959253653_46344 pause
λ VBoxManage.exe controlvm c7-docker_default_1591959253653_46344 resume
3,查看虚拟机
VBoxManage list [--long|-l] [--sorted|-s] vms|runningvms|ostypes|hostdvds|hostfloppies|
intnets|bridgedifs|hostonlyifs|natnets|dhcpservers|
hostinfo|hostcpuids|hddbackends|hdds|dvds|floppies|
usbhost|usbfilters|systemproperties|extpacks|
groups|webcams|screenshotformats|cloudproviders|
cloudprofiles
#=============list vms =================
λ VBoxManage.exe list vms
"test-c7_default_1589439500366_74357" {cef17aa3-8c5f-44b6-a989-04247a14fdd9}
"c6_default_1590198803624_43446" {a38d3bb0-e49d-4996-956f-895f1688fc3a}
"w10" {ab90e1b9-3f02-4ca0-ba09-02227ba71700}
"c7-docker_default_1591959253653_46344" {480c1b45-46bf-444d-a01b-667c76db4a83}
λ VBoxManage.exe list runningvms
"test-c7_default_1589439500366_74357" {cef17aa3-8c5f-44b6-a989-04247a14fdd9}
"c7-docker_default_1591959253653_46344" {480c1b45-46bf-444d-a01b-667c76db4a83}
#=============showvminfo =================
λ VBoxManage.exe showvminfo c7-docker_default_1591959253653_46344 |grep stat -i
State: paused (since 2020-08-06T02:50:07.074000000)
λ VBoxManage.exe showvminfo c7-docker_default_1591959253653_46344 |grep mem -i
Memory size 3000MB
Configured memory balloon size: 0MB
λ VBoxManage.exe showvminfo c7-docker_default_1591959253653_46344 |grep cpu -i
CPU exec cap: 100%
CPUProfile: host
Number of CPUs: 1
CPUID Portability Level: 0
CPUID overrides: None
4,修改虚拟机:磁盘,内存,cpu
VBoxManage modifyvm <uuid|vmname>
[--name <name>]
[--memory <memorysize in MB>]
[--cpus <number>]
[--autostart-enabled on|off]
[--autostart-delay <seconds>]
#============modifyvm xx --name ==================
λ VBoxManage.exe list vms
"c7_default_1589441620512_61309" {bda3c131-9d17-4fd6-8b17-e1d70651e12b}
λ VBoxManage.exe modifyvm c7_default_1589441620512_61309 --name c7-docker
λ VBoxManage.exe list vms
"c7-docker" {bda3c131-9d17-4fd6-8b17-e1d70651e12b}
#============modifyvm xx --memory ==================
λ VBoxManage.exe showvminfo c7-docker |grep -i mem
Memory size 2120MB
Configured memory balloon size: 0MB
λ VBoxManage.exe modifyvm c7-docker --memory 3072
λ VBoxManage.exe showvminfo c7-docker |grep -i mem
Memory size 3072MB
Configured memory balloon size: 0MB
#===============createmedium 添加磁盘 ===============
createmedium [disk|dvd|floppy] --filename <filename>
[--size <megabytes>|--sizebyte <bytes>]
[--diffparent <uuid>|<filename>
[--format VDI|VMDK|VHD] (default: VDI)
[--variant Standard,Fixed,Split2G,Stream,ESX,
Formatted]
λ VBoxManage.exe createmedium disk --filename D:/a.vmdk --size 512
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: 823698d5-b82c-46e4-8da6-49d732ce13b2
=========
storageattach <uuid|vmname>
--storagectl <name>
[--port <number>] 0:第一控制器,1:第二控制器
[--device <number>] 0:主通道, 1:从通道
[--type dvddrive|hdd|fdd]
[--medium none|emptydrive|additions|
λ VBoxManage.exe storageattach test-c65_default_1589782366908_91217 --storagectl IDE --type hdd --medium D:/a.vmdk --port 2 --device 2
VBoxManage.exe: error: The port and/or device parameter are out of range: port=2 (must be in range [0, 1]), device=2 (must be in range [0, 1])
VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component StorageControllerWrap, interface IStorageController, callee IUnknown
VBoxManage.exe: error: Context: "AttachDevice(Bstr(pszCtl).raw(), port, device, DeviceType_HardDisk, pMedium2Mount)" at line 776 of file VBoxManageStorageController.cpp
λ VBoxManage.exe storageattach test-c65_default_1589782366908_91217 --storagectl IDE --type hdd --medium D:/a.vmdk --port 1 --device 1
更多推荐
已为社区贡献8条内容
所有评论(0)