VBoxManage命令速记

1、IDE控制器
创建:
VBoxManage storagectl testvm --name "IDE Controller" --add ide
卸载
VBoxManage storagectl testvm --name "IDE Controller" --remove

2、虚拟磁盘
a、创建磁盘

VBoxManage createvdi --filename /home/virtualbox/winxp.vdi --size 5000 --remember
删除存储设备
VBoxManage closemedium disk /home/virtualbox/winxp.vdi --delete
重新设置存储设备在virtualbox中的uuid,其中4ed3933b-7871-47a9-8f53-093b9dbb1762为指定的新uuid
VBoxManage storageattach "testvm" --storagectl "IDE Controller" --port 1 --device 0 --type hdd --medium /home/virtualbox/winxp.vdi --setuuid 4ed3933b-7871-47a9-8f53-093b9dbb1762

b、显示磁盘信息

VBoxManage showvdiinfo /home/virtualbox/winxp.vdi

c、删除虚拟硬盘UUID重新分配

VBoxManage clonevdi 670fd01f-6383-4d32-a089-ac42b51a5d07 /root/"VirtualBox VMs"/testvm/testvm2.vdi

修改

VBoxManage modifyvdi        <uuid>|<filename> compact 压缩指定的虚拟硬盘
VBoxManage clonevdi         <uuid>|<filename> <outputfile> 克隆指定的VDI虚拟硬盘
VBoxManage convertdd        [-static] <filename> <outputfile> 将raw硬盘转换成vdi虚拟硬盘

挂载到ide
VBoxManage modifyvm testvm --hda /root/"VirtualBox VMs"/testvm/testvm.vdi

或者
VBoxManage storageattach testvm --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /root/VirtualBox VMs/testvm/testvm.vdi
卸载
VBoxManage storageattach testvm --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium none

或者
VBoxManage modifyvm testvm --hda none

3、虚拟光盘

a、挂载虚拟光盘
VBoxManage storageattach testvm --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /usr/share/virtualbox/VBoxGuestAdditions.iso
或者
VBoxManage modifyvm testvm --dvd /usr/share/virtualbox/VBoxGuestAdditions2.iso

b、卸载虚拟光盘

VBoxManage storageattach testvm --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium none

4、挂载usb

VBoxManage list usbhost
VBoxManage controlvm testvm usbattach 42bc94ab-9bf7-4bec-940b-1d525f656c9c

5、虚拟声卡
VBoxManage modifyvm testvm --audio dsound

附命令大全:
http://www.virtualbox.org/manual/ch08.html#vboxmanage-clonevm

原文地址:https://www.cnblogs.com/yjken/p/3922088.html