|
公司不允許使用盜版軟件,所以工作使用虛擬機是VirtualBox,但是在使用的過程中發(fā)現這個VirtualBox的USB搞不定,無法使用USB設備。沒有辦法只有轉投Vmware,使用免費的VmwarePlayer。只是已經安裝的VirtualBox虛擬機不想浪費了,畢竟已經安裝了很多的軟件。 網絡上大部分都在說如何把VMware導入到VirtualBox中,我在最新的版本到看到VirtualBox (3.2.2)已經支持VMware虛擬硬盤格式vmdk,所以新建一個VBox虛擬機,直接注冊VMware的虛擬硬盤就可以了。 其實沒有必要把整個虛擬機相互轉換,只要把虛擬硬盤鏡像轉換就可以了,不需要轉換,但是要在VMplayer中使用VDI格式的硬盤鏡像就得費點勁轉換一個格式了。 使用第三種虛擬機來完成這個工作--qemu, ![]() 知道可以使用qemu-img來轉換,按照上面的說明安裝qemu-kvm,使用過程中發(fā)現可以當前的qemu版本已經支持幾乎所有的虛擬硬盤格式,參照下面的命令幫助。 在Ubuntu下可以很方便的安裝 shily@hh-desktop:~#sudo apt-get install qemu-kvm 使用如下一個命令就可以輕松完成轉換。 shily@hh-desktop:~#qemu-img convert -f vdi -O vmdk Winxp.vdi Winxp.vmdk 直接修改已經建好的虛擬機,(Ubuntu系統(tǒng)在~/vmware/) 例如我建立的虛擬機叫Win,則修改 ~/vmware/Win/Win.vmx,找到 ide0:0.fileName = "Win.vmdk" 把其中的Win.vmdk修改成你轉換生成的文件名即可。 [注]: 1,Winxp.vdi要根據VitrualBox虛擬機的名稱修改,在目錄~/.VirtualBox/HardDisks下可以找到。 2,.vmx 是VMware虛擬機的配置文件,是一個文本文件可以直接修改,也可以在程序中更改,刪除原來的硬盤,再添加轉換后的硬盤。 ====================== shily@hh-desktop:~$ qemu-img qemu-img version 0.12.3, Copyright (c) 2004-2008 Fabrice Bellard usage: qemu-img command [command options] QEMU disk image utility Command syntax: check [-f fmt] filename create [-f fmt] [-o options] filename [size] commit [-f fmt] filename convert [-c] [-f fmt] [-O output_fmt] [-o options] filename [filename2 [...]] output_filename info [-f fmt] filename snapshot [-l | -a snapshot | -c snapshot | -d snapshot] filename Command parameters: 'filename' is a disk image filename 'fmt' is the disk image format. It is guessed automatically in most cases 'size' is the disk image size in bytes. Optional suffixes 'k' or 'K' (kilobyte, 1024), 'M' (megabyte, 1024k), 'G' (gigabyte, 1024M) and T (terabyte, 1024G) are supported. 'b' is ignored. 'output_filename' is the destination disk image filename 'output_fmt' is the destination format 'options' is a comma separated list of format specific options in a name=value format. Use -o ? for an overview of the options supported by the used format '-c' indicates that target image must be compressed (qcow format only) '-h' with or without a command shows this help and lists the supported formats Parameters to snapshot subcommand: 'snapshot' is the name of the snapshot to create, apply or delete '-a' applies a snapshot (revert disk to saved state) '-c' creates a snapshot '-d' deletes a snapshot '-l' lists all snapshots in the given image 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 ====================== 參考:Howto Convert Vmware Image to Virtualbox Image or Import Vmware Image into Virtualbox ====================================== 2010-06-06 更新 警告:安裝qemu-kvm可能導致virtualbox無法啟動,在我的機器上出現了如下提示: 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:Result Code: NS_ERROR_FAILURE (0x80004005) Component: Console Interface: IConsole {6375231a-c17c-464b-92cb-ae9e128d71c3} 說可能導致的原因是我的系統(tǒng)環(huán)境比較復雜:安裝在USB硬盤上,經常在T60p和Dell的740上工作,他們的CPU一個是Intel、另外一個是AMD,比較郁悶。在網上找到一個解決方案。 shily@hh-desktop:~$sudo modprobe -r kvm_intel #因為我當前的CPU是Intel,你也可以直接使用sudo modprobe -r kvm來刪除kvm模塊,無論你使用什么樣的CPU。 然后打開VirtualBox就可以了,但是你需要在每次重啟開機后執(zhí)行這個命令,如果你需要啟動Vbox的話。 參照: VirtualBox can't operate in VMX root mode. 很郁悶的是,我在開啟虛擬機后發(fā)現USB設備已經可以在虛擬機中正常使用了,我并不清楚什么原因導致可以使用。 ========================== 最新更新: 學習了些新東西,找到了原因。 發(fā)現我系統(tǒng)中的 /etc/udev/rules.d/10-vboxdrv.rules 文件不知道什么原因消失了。 重新建立一個,寫入以下內容: KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600" SUBSYSTEM=="usb_device", GROUP="vboxusers", MODE="0664" SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="vboxusers", MODE="0664" 重新啟動虛擬機,就可以使用USB了。 |
|
|