VirtualBox命令行创建虚拟机及无法启动虚拟机时问题处理

时间:2020-12-23 23:40:36

环境 win7

在path里加入virtual box路径

创建虚拟机

VBoxManage.exe createvm --name xie1 --register

VirtualBox命令行创建虚拟机及无法启动虚拟机时问题处理

修改内存及操作系统

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"

VirtualBox命令行创建虚拟机及无法启动虚拟机时问题处理

启动

VBoxManage.exe startvm xie1

virtual box启动虚拟机时一个问题处理

提示:
不能为虚拟电脑**打开一个新任务。

在贴吧看到解决方案:
http://tieba.baidu.com/p/3420800826
还原uxtheme.dll文件。
注意替换前要把c:/windows/system32下原有的uxtheme.dll改名。

clone

VboxManage clonehd centos1/centos1.vdi centos6/centos6.vdi

直接复制虚拟机以后可能会出现找不到网卡,处理方法:
首先看一下这里的网卡MAC地址:
VirtualBox命令行创建虚拟机及无法启动虚拟机时问题处理

然后修改:
/etc/sysconfig/network-scripts/ifcfg-eth0 中的HWADDR 参数与上面保持一致。

有时候出现网络不可达,或Network is unreachable,参考:
http://blog.csdn.net/xundh/article/details/46618233?locationNum=1&fps=1#t28