网络上大部分都在说如何把VMware导入到VirtualBox中,我在最新的版本到看到VirtualBox (3.2.2)已经支持VMware虚拟硬盘格式vmdk,所以新建一个VBox虚拟机,直接注册VMware的虚拟硬盘就可以了。
8 a. V2 Y8 T8 x: Q# ^: C9 [其实没有必要把整个虚拟机相互转换,只要把虚拟硬盘镜像转换就可以了,不需要转换,但是要在VMplayer中使用VDI格式的硬盘镜像就得费点劲转换一 个格式了。
: o+ }# A4 q8 X使用第三种虚拟机来完成这个工作--qemu, " D& y- n- v: x5 J5 r& }' @0 C4 U7 h
知道可以使用qemu-img来转换,按照上面的说明安装qemu-kvm,使用过程中发现可以当前的qemu版本已经支持几乎所有的虚拟硬盘格式,参照 下面的命令帮助。 , S: x, \: S' c1 i+ U
在Ubuntu下可以很方便的安装 + D3 r+ w6 P2 |: H. _" q
shily@hh-desktop:~# sudo apt-get install qemu-kvm0 P) t( j# K w2 H* r
使用如下一个命令就可以轻松完成转换。 : ?- c5 B/ a0 q Z; p- f8 a
shily@hh-desktop:~# qemu-img convert -f vdi -O vmdk Winxp.vdi Winxp.vmdk; ~. x: X! s* S- ~( [- ?+ M
直接修改已经建好的虚拟机,(Ubuntu系统在~/vmware/)
% z9 A+ |: _& h! s: t例如我建立的虚拟机叫Win,则修改 ~/vmware/Win/Win.vmx,找到 ide0:0.fileName = "Win.vmdk" / ` p3 K0 w) T0 `3 d# J- @
把其中的Win.vmdk修改成你转换生成的文件名即可。 4 H; r: z/ z( {7 v$ n' M
[注]:
7 x2 Z4 H8 y4 P7 K4 X* e0 {1,Winxp.vdi要根据VitrualBox虚拟机的名称修改,在目录~/.VirtualBox/HardDisks下可以找到。 $ q7 ?5 ]7 W0 Y# E$ o! H
2,.vmx 是VMware虚拟机的配置文件,是一个文本文件可以直接修改,也可以在程序中更改,删除原来的硬盘,再添加转换后的硬盘。
. K) K* }, B3 R# v====================== 0 ]4 Y; [" D( d
shily@hh-desktop:~$ qemu-img
8 K6 g) C, L3 b$ z# M- z1 v lqemu-img version 0.12.3, Copyright (c) 2004-2008 Fabrice Bellard
$ S* h' J) [# [# `usage: qemu-img command [command options]
! Q7 U" z; H2 R: G J8 ZQEMU disk image utility
4 ?+ A' W) Y, r3 I' U0 i# m0 F
- p% r: ^/ g# n% [0 BCommand syntax: . y. K( ]+ `3 c K! r
check [-f fmt] filename ) Y7 ^) r* H. M: B+ {/ m6 D
create [-f fmt] [-o options] filename [size] . C, _9 o- @* f- T
commit [-f fmt] filename 1 C# q( v2 b/ H( |% U& D; l# }) T
convert [-c] [-f fmt] [-O output_fmt] [-o options] filename [filename2 [...]] output_filename ! I& _6 M% I+ ?" p- N: H! D5 i
info [-f fmt] filename 8 d$ ~6 _3 F+ t A2 }- S e: q
snapshot [-l | -a snapshot | -c snapshot | -d snapshot] filename 1 J# ~$ `9 T" i5 y
+ d5 {2 r. G- v. Y2 BCommand parameters:
4 H" o- ~6 @6 a4 P) W: O'filename' is a disk image filename
3 {4 {; v" s4 r" g" l* p6 {2 p'fmt' is the disk image format. It is guessed automatically in most cases
4 k; B- x8 s6 W- F'size' is the disk image size in bytes. Optional suffixes
! Y4 B5 K+ Z. H8 n. N/ ]/ K'k' or 'K' (kilobyte, 1024), 'M' (megabyte, 1024k), 'G' (gigabyte, 1024M) : M- | G0 f, ?! r; [: A- e7 W1 `2 l0 k! v) `
and T (terabyte, 1024G) are supported. 'b' is ignored. " r; n2 h, q9 g B, h
'output_filename' is the destination disk image filename
' |1 M9 v8 g$ x7 H( [9 b P'output_fmt' is the destination format 6 D! |- ]6 g0 @, p
'options' is a comma separated list of format specific options in a
- K- i. l, q' B# i7 P: }9 Ename=value format. Use -o ? for an overview of the options supported by the
1 k" v" _- V- h! [+ g+ C1 qused format ) d9 v: O d4 L2 u8 Y, E
'-c' indicates that target image must be compressed (qcow format only) 1 b$ Q! e4 C3 b7 v& V' [
'-h' with or without a command shows this help and lists the supported formats
8 H" u8 K3 h" T: E* A9 s6 Q0 H* U7 l
Parameters to snapshot subcommand: 7 n0 t0 i. B0 V8 e M0 k
'snapshot' is the name of the snapshot to create, apply or delete 4 a) G" @8 s5 f
'-a' applies a snapshot (revert disk to saved state) " S- M! z# p1 D
'-c' creates a snapshot
9 \ e8 c0 M0 t1 A7 k/ _'-d' deletes a snapshot
& x: r. ^* G2 r' B& @( {'-l' lists all snapshots in the given image # e) M5 y4 \, h8 p6 [7 k' R
6 T: N, K: c5 q/ A4 N
Supported formats: cow qcow vdi vmdk cloop dmg bochs vpc vvfat qcow2 parallels nbd host_cdrom host_floppy host_device raw tftp ftps ftp https http
2 g7 P4 t, S4 J) w$ n; a3 [: ^) x) e* j
====================== ; e- M, W% k. _+ S5 {
参考: 8 `* I, L' G9 Z! Q) K$ i$ B
======================================
8 S9 d3 E3 R9 O# b2010-06-06 更新
3 n8 a4 m9 p5 ~9 K警告:安装qemu-kvm可能导致virtualbox无法启动,在我的机器上出现了如下提示: 2 p) _1 x0 y. @7 Q" P. \8 n
+ U; h U; X2 G" |( u$ {8 ~$ [
Failed to open a session for the virtual machine WinXP. VirtualBox can't operate in VMX root mode. Please disable the KVM kernel extension, recompile your kernel and reboot (VERR_VMX_IN_VMX_ROOT_MODE). Details:
& a/ w6 o# K% d$ y* \Result Code:
0 p6 t# j i! nNS_ERROR_FAILURE (0x80004005)
& P5 T2 e0 m" U$ V! HComponent:
8 {# a1 |/ C7 S( q/ W0 J RConsole : V1 P3 k& H! X% k7 t; e; X7 p) d3 H
Interface: g( S1 h1 [5 J9 x
IConsole {6375231a-c17c-464b-92cb-ae9e128d71c3}
- h" l7 t1 ?3 H5 s( ~; [ h! L1 @$ G' p" r7 ^( x* V1 w8 D F
说 可能导致的原因是我的系统环境比较复杂:安装在USB硬盘上,经常在T60p和Dell的740上工作,他们的 CPU一个是Intel、另外一个是AMD,比较郁闷。在网上找到一个解决方案。 # Z0 y2 b) T$ p: f- z# I
shily@hh-desktop:~$ sudo modprobe -r kvm_intel #因为我当前的CPU是Intel,你也可以直接使用sudo modprobe -r kvm来删除kvm模块,无论你使用什么样的CPU。
4 j- p4 @+ ]! i! |5 g$ W( W* R4 B然后打开VirtualBox就可以了,但是你需要在每次重启开机后执行这个命令,如果你需要启动Vbox的话。 $ S8 Q: B) ` `2 [4 g
( }. y/ ^" G w- k
参照: 6 A; `9 K7 e- m& n
: j4 ^5 h2 b8 ~- a4 m, e6 X
很郁闷的是,我在开启虚拟机后发现USB设备已经可以在虚拟机中正常使用了,我并不清楚什么原因导致可以使用。
. g4 E* W: t9 k========================== ; u% ^2 V. I9 C2 }4 ^
最新更新:
1 J1 P3 B! H( b8 s( I! c5 r( s学习了些新东西,找到了原因。
3 L' \6 E! Q# |, [0 w! ^3 p发现我系统中的 /etc/udev/rules.d/10-vboxdrv.rules 文件不知道什么原因消失了。 / [+ n. N3 o$ j
重新建立一个,写入以下内容: & M- x- Y; V5 `$ e
. y- N( E9 x2 uKERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600" 4 F! R8 T4 y: ? w. ?: O
SUBSYSTEM=="usb_device", GROUP="vboxusers", MODE="0664"
7 U. h# {1 |; ?# i4 K) l. bSUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="vboxusers", MODE="0664" ! t6 x A, X: [7 D
6 ^' W7 D) _/ E# O5 R
重新启动虚拟机,就可以使用USB了。 |