轉自:https://blog.51cto.com/dahui09/1863486
方法一:
使用VirtualBox 自帶的VBoxManage來進行格式轉換:
1、安裝VBoxManage
2、使用VBoxManage格式轉換指令轉為Vmware能識別的(vmdk)格式
方法二:
vdi轉成VM虛擬機文件vmdk文件並生成vm虛擬機配置文件
1、vbox導出ova虛擬機文件
2、用VM虛擬機打開ova文件
方法三:
我們將使用qemu-img工具。QEMU磁盤鏡像工具(這個要在能開機的情況下開始,安裝qemu-kvm可能導致virtualbox無法啟動)
1、安裝qemu-kvm 軟件
2、修改已經建好的虛擬機,更改格式
========================================================================
方法一:
1.VBoxManage.exe在VirtualBox 安裝目錄下,如下圖,我們進VirtualBox 安裝目錄查看到VBoxManage.exe
2.命令行進入VirtualBox目錄,運行相關VBoxManage格式轉換指令,語法如下:
3.將VDI文件轉成VHD文件,如下圖命令將vdi的虛擬機文件轉換成微軟vhd虛擬機文件:
執行進度至100%結束完成轉換,隨后我們用微軟虛擬機軟件掛載順利運行
至此,利用VBoxManage對三種常見虛擬硬盤格式轉換介紹結束,vmdk、vhd轉VDI等按格式套用即可。
方法二:
xp.vdi轉成VM虛擬機文件vmdk文件並生成vm虛擬機的配置文件vmx文件
1. virtal box 導入vdi文件
文件轉換步驟
2.導出ova虛擬機文件
(1). ovf文件選擇1.0格式。
(2). 2.0格式,第三步通不過。
(3). 用vmworkstaion打開ova文件
(4).打開step_2.vmx
方法三:
在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系統在~/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 p_w_picpath 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 p_w_picpath filename
'fmt' is the disk p_w_picpath format. It is guessed automatically in most cases
'size' is the disk p_w_picpath 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 p_w_picpath 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 bythe
used format
'-c' indicates that target p_w_picpath must be compressed (qcow format only)
'-h' with or without a command shows this help and lists the supportedformats
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 p_w_picpath
Supported formats: cow qcow vdi vmdk cloop dmg bochs vpc vvfat qcow2parallels nbd host_cdrom host_floppy host_device raw tftp ftps ftp https http
======================
參考:
Howto ConvertVmware Image to Virtualbox Image or Import Vmware Image into Virtualbox
======================================
警告:
安裝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 kernelextension, 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}
說
可能導致
的原因是系統環境比較復雜:安裝在USB硬盤上,經常在T60p和Dell的740上工作,他們的 CPU一個是Intel、另外一個是AMD,在網上找到一個解決方案。
shily@hh-desktop:~$
sudo modprobe -r kvm_intel
#因為我當前的CPU是Intel,你也可以直接使用sudo modprobe -r kvm來刪除kvm模塊,無論你使用什么樣的CPU。
然后打開VirtualBox就可以了,但是你需要在每次重啟開機后執行這個命令,如果你需要啟動Vbox的話。
參照:
VirtualBox can't operate in VMX rootmode.