环境 win7
在path里加入virtual box路径
创建虚拟机
VBoxManage.exe createvm --name xie1 --register
修改内存及操作系统
VBoxManage.exe modifyvm vm_name --memory 1024 --vram 64 --acpi on --boot1 dvd --ostype "Linux"
OSType值列表
ID: Other
Description: Other/Unknown
ID: Windows31
Description: Windows 3.1
ID: Windows95
Description: Windows 95
ID: Windows98
Description: Windows 98
ID: WindowsMe
Description: Windows Me
ID: WindowsNT4
Description: Windows NT 4
ID: Windows2000
Description: Windows 2000
ID: WindowsXP
Description: Windows XP
ID: WindowsXP_64
Description: Windows XP (64 bit)
ID: Windows2003
Description: Windows 2003
ID: Windows2003_64
Description: Windows 2003 (64 bit)
ID: WindowsVista
Description: Windows Vista
ID: WindowsVista_64
Description: Windows Vista (64 bit)
ID: Windows2008
Description: Windows 2008
ID: Windows2008_64
Description: Windows 2008 (64 bit)
ID: Windows7
Description: Windows 7
ID: Windows7_64
Description: Windows 7 (64 bit)
ID: WindowsNT
Description: Other Windows
ID: Linux22
Description: Linux 2.2
ID: Linux24
Description: Linux 2.4
ID: Linux24_64
Description: Linux 2.4 (64 bit)
ID: Linux26
Description: Linux 2.6
ID: Linux26_64
Description: Linux 2.6 (64 bit)
ID: ArchLinux
Description: Arch Linux
ID: ArchLinux_64
Description: Arch Linux (64 bit)
ID: Debian
Description: Debian
ID: Debian_64
Description: Debian (64 bit)
ID: OpenSUSE
Description: openSUSE
ID: OpenSUSE_64
Description: openSUSE (64 bit)
ID: Fedora
Description: Fedora
ID: Fedora_64
Description: Fedora (64 bit)
ID: Gentoo
Description: Gentoo
ID: Gentoo_64
Description: Gentoo (64 bit)
ID: Mandriva
Description: Mandriva
ID: Mandriva_64
Description: Mandriva (64 bit)
ID: RedHat
Description: Red Hat
ID: RedHat_64
Description: Red Hat (64 bit)
ID: Turbolinux
Description: Turbolinux
ID: Turbolinux
Description: Turbolinux (64 bit)
ID: Ubuntu
Description: Ubuntu
ID: Ubuntu_64
Description: Ubuntu (64 bit)
ID: Xandros
Description: Xandros
ID: Xandros_64
Description: Xandros (64 bit)
ID: Oracle
Description: Oracle
ID: Oracle_64
Description: Oracle (64 bit)
ID: Linux
Description: Other Linux
ID: Solaris
Description: Solaris legacy
ID: Solaris_64
Description: Solaris legacy (64 bit)
ID: OpenSolaris
Description: Solaris modern (S10U8+)
ID: OpenSolaris_64
Description: Solaris modern (S10U8+) (64 bit)
ID: FreeBSD
Description: FreeBSD
ID: FreeBSD_64
Description: FreeBSD (64 bit)
ID: OpenBSD
Description: OpenBSD
ID: OpenBSD_64
Description: OpenBSD (64 bit)
ID: NetBSD
Description: NetBSD
ID: NetBSD_64
Description: NetBSD (64 bit)
ID: OS2Warp3
Description: OS/2 Warp 3
ID: OS2Warp4
Description: OS/2 Warp 4
ID: OS2Warp45
Description: OS/2 Warp 4.5
ID: OS2eCS
Description: eComStation
ID: OS2
Description: Other OS/2
ID: MacOS
Description: Mac OS X Server
ID: MacOS_64
Description: Mac OS X Server (64 bit)
ID: DOS
Description: DOS
ID: Netware
Description: Netware
ID: L4
Description: L4
ID: QNX
Description: QNX
ID: JRockitVE
Description: JRockitVE
设置硬盘(100G自动增长)
VBoxManage.exe createhd --filename D:/vbox/CentOS64/disk_name.vdi --size 102400
增加IDE 控制器
VBoxManage.exe storagectl xie1 --name "IDE Controller" --add ide --bootable on
挂载
VBoxManage.exe storageattach xie1 --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium D:/vbox/CentOS64/disk1.vdi
VBoxManage.exe storageattach xie1 --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium "D:/BaiduYunDownload/CentOS-7.0-1406-x86_64-Everything.iso"
设置网卡
VBoxManage.exe modifyvm xie1 --nic1 hostonly --nic2 bridged
VBoxManage.exe modifyvm xie1 --hostonlyadapter1 "VirtualBox Host-Only Ethernet Adapter" --bridgeadapter2 "Realtek PCIe GBE Family Controller"
启动
VBoxManage.exe startvm xie1
VBoxManage addiscsidisk -server | 通过指定服务器名称|ip地址添加ISCSI硬盘
-target 指定对象名称字符串
[-port ] 指定ISCSI对象的服务端口号
[-lun ] 指定对象资源的逻辑单元编号
[-encodedlun ] 指定另一种格式的对象资源的逻辑单元编号
[-username ] 指定连接ISCSI对象的用户名
[-password ] 指定连接ISCSI对象所需的密码
[-comment ] 为这个连接添加一段描述性文字
比如:VBoxManage addiscsidisk -server 10.200.2.30 -target iqn.2000-12.com.acme:storage.lun0 -lun 0
VBoxManage createhostif 在宿主机添加一个指定名称的虚拟网络接口
VBoxManage removehostif | 从宿主机删除指定UUID|名称的虚拟网络接口
VBoxManage getextradata global| 获取全局设置信息
| 获取指定UUID的虚拟机的信息
获取指定名称的虚拟机的信息
| 获取与指定键值相关联的数据信息
enumerate 列举信息
比如:VBoxManage getextradata xp installdate 用于获取虚拟机XP的安装时间
VBoxManage setextradata global| 设置全局信息
| 设置指定UUID的虚拟机的信息
设置指定名称的虚拟机的信息
指定要添加信息的键
[] 给上面的键添加键值(必须指定键值)
比如:VBoxManage setextradata xp installdate 2006.01.01 设置虚拟机xp的安装时间为2006年1月1日
VBoxManage setproperty vdifolder default| 在全局设定里设置vdi目录为默认
| 在全局设定里设置指定vdi目录
machinefolder default| 在全局设定里设置虚拟机目录为默认
| 在全局设定里指定虚拟机目录
vrdpauthlibrary default| 在全局设定里设置VRDP证书为默认的证书 | 在全局设定里指定其他的VRDP证书
websrvauthlibrary default| 在全局设定里设置Web服务证书为默认的证书
null| 在全局设定里设置web服务证书为空 | 在全局设定里指定其他的Web服务证书
hwvirtexenabled yes|no 在全局设定里设置是|否支持硬件虚拟化
loghistorycount 在全局设定里设置日志数目,编号从0开始
VBoxManage usbfilter add <index,0-n>添加usb筛选器并设置它在筛选器列表中的位置
-target | 添加usb筛选器到指定UUID的虚拟机
| 添加usb筛选器到指定名称的虚拟机
global 添加全局usb筛选器
-name 给usb筛选器指定名称
-action ignore| 不允许虚拟机连接到筛选器
hold 允许虚拟机连接到筛选器(全局筛选器时)
[-active yes|no] 筛选器是|否生效(默认是生效)
[-vendorid ] 给usb筛选器指定vendorid(厂商标志)
[-productid ] 给usb筛选器指定productid(产品标志号)
[-revision ] 给usb筛选器指定revision(修订版本号)
[-manufacturer ] 给usb筛选器指定manufacturer(制造商)
[-product ] 给usb筛选器指定product(产品标志)
[-remote yes|no] 指定usb筛选器是|否在远程登陆时有效
[-serialnumber ] 给usb筛选器指定serialnumber(序列号)
[-maskedinterfaces ]
VBoxManage usbfilter modify <index,0-n>修改usb筛选器在列表中的顺序
-target | 修改指定UUID的虚拟机的usb筛选器
| 修改指定名称的虚拟机的usb筛选器
global 修改全局设置的usb筛选器
[-name ] 修改筛选器名称
[-action ignore| 不允许虚拟机连接到筛选器
hold] 允许虚拟机连接到筛选器(全局筛选器时)
[-active yes|no] 筛选器是|否生效(默认是生效)
[-vendorid |””] 给usb筛选器指定vendorid(厂商标志)
[-productid |””] 给usb筛选器指定productid(产品标志号)
[-revision |””] 给usb筛选器指定revision(修订版本号)
[-manufacturer |””] 给usb筛选器指定manufacturer(制造商)
[-product |””] 给usb筛选器指定product(产品标志)
[-remote yes|no] 指定usb筛选器是|否在远程登陆时有效
[-serialnumber |””] 给usb筛选器指定serialnumber(序列号)
[-maskedinterfaces |””]</index,0-n></index,0-n>
VBoxManage usbfilter remove <index,0-n>删除指定序号的usb筛选器
-target | 删除指定UUID的虚拟机的usb筛选器
| 删除指定名称的虚拟机的usb筛选器
global 删除全局usb筛选器</index,0-n>
VBoxManage sharedfolder add | 添加共享文件夹到指定名称的虚拟机
添加共享文件夹到指定uuid的虚拟机
-name 指定共享文件夹名称
-hostpath 指定共享文件夹所在的主机路径
[-transient] 设置临时共享
[-readonly] 设置共享为只读
VBoxManage sharedfolder remove | 从指定名称的虚拟机删除共享文件夹
从指定UUID的虚拟机删除共享文件夹
-name 删除指定名称的共享文件夹
[-transient] 临时删除
VBoxManage vmstatistics | 统计指定名称的虚拟机的运行状态信息
统计指定UUID的虚拟机的运行状态信息
[-reset] 复位统计信息
[-pattern ] 设置信息的显示格式
[-descriptions] 在统计信息中显示描述信息
VBoxManage guestproperty get | 获取指定名称的虚拟机的预先设定的属性值
获取指定UUID的虚拟机的预先设定的属性值 获取指定属性的预先设定的值
[-verbose] 以冗长的格式显示
VBoxManage guestproperty set | 给指定名称的虚拟机设置属性值
给指定UUID的虚拟机设置属性值 要设定值的属性
[ 给属性设定的值
[-flags ]] 设置一个标志
VBoxManage guestproperty enumerate | 列举指定名称的虚拟机的属性值
列举指定UUID的虚拟机的属性值
[-patterns ] 列举属性值时采用的格式
VBoxManage metrics list [*| 显示性能计数器
收集的所有系统资源的监测数据
host| 显示性能计数器
收集的宿主机的系统资源的监测数据
显示性能计数器
收集的虚拟机的系统资源的监测数据
[]] 要显示的性能计数器列表
VBoxManage metrics setup 设置性能计数器
[-period ] 设置性能计数器的显示周期
[-samples ] 设置性能计数器抽样统计数
[*| 对所有资源设置设置性能计数器
host| 对宿主机资源设置设置性能计数器
对虚拟机资源设置设置性能计数器
[]] 性能计数器列表
例如:VBoxManage metrics setup -period 1 -samples 5 host CPU/Load,RAM/Usage
VBoxManage metrics query [*| 查找并显示所有资源当前的性能计数器
host| 查找并显示宿主机当前的资源的性能计数器
查找并显示虚拟机当前的资源的性能计数器
[]] 性能计数器列表
例如:VBoxManage query host CPU/Load/User,CPU/Load/Kernel
VBoxManage metrics collect 收集性能计数器信息
[-period ] 设置性能计数器信息显示的刷新周期
[-samples ] 设置性能计数器抽样统计数
[-list] 显示当前可以收集信息的性能计数器
[-detach]
[*| 收集所有系统资源的性能计数器信息
host| 收集宿主机资源的性能计数器信息
收集虚拟机资源的性能计数器信息
[]] 性能计数器列表