VirtualBox启动和关闭虚拟机

293 阅读1分钟

当前所有虚拟机(各种状态)

kk@kk-OptiPlex-5050:~$ VBoxManage list vms
"ubuntu" {28746d48-0875-4f77-92a5-615e92bd5a4e}
"#centos2 k8s-node1" {d401a832-4815-4f6d-afa5-85d5d66d3dd5}
"centos3 k8s-node2" {a2886c6d-50e3-4866-9671-4364fd2a7fc8}
"centos4 k8s-node3" {71c348ad-c0ef-4ca4-970b-82039541d204}
"#centos5" {4a41661c-fff2-46b0-b5c9-32c3da7dbf96}
"centos-test" {7424e280-237b-4185-b8d5-48607886b732}
"centos-test2" {6e02d8d5-51be-44f8-a140-abcefab93764}
"centos6 k8s-master1" {2bf0022c-3772-4cae-9687-452fb78b3697}

正在运行的虚拟机

kk@kk-OptiPlex-5050:~$ VBoxManage list runningvms
"centos3 k8s-node2" {a2886c6d-50e3-4866-9671-4364fd2a7fc8}
"centos4 k8s-node3" {71c348ad-c0ef-4ca4-970b-82039541d204}
"centos6 k8s-master1" {2bf0022c-3772-4cae-9687-452fb78b3697}

正常关闭虚拟机,发送关机指令;非强制断电

kk@kk-OptiPlex-5050:~$ VBoxManage controlvm a2886c6d-50e3-4866-9671-4364fd2a7fc8  acpipowerbutton
kk@kk-OptiPlex-5050:~$ VBoxManage controlvm 71c348ad-c0ef-4ca4-970b-82039541d204  acpipowerbutton
kk@kk-OptiPlex-5050:~$ VBoxManage controlvm 2bf0022c-3772-4cae-9687-452fb78b3697  acpipowerbutton

启动虚拟机

kk@kk-OptiPlex-5050:~$ VBoxManage startvm  a2886c6d-50e3-4866-9671-4364fd2a7fc8
Waiting for VM "a2886c6d-50e3-4866-9671-4364fd2a7fc8" to power on...
VM "a2886c6d-50e3-4866-9671-4364fd2a7fc8" has been successfully started.

批量启动 虚拟机

VBoxManage startvm  a2886c6d-50e3-4866-9671-4364fd2a7fc8 71c348ad-c0ef-4ca4-970b-82039541d204 2bf0022c-3772-4cae-9687-452fb78b3697