KVM has the ability to use VMware's .vmdk disk files directly, as long as the disk is wholly contained in a single vmdk file. However, VMware also allows splitting a disk into multiple smaller vmdk files, usually 2 GB each. KVM can't use these. You can convert these files into a single virtual disk file using vmware-vdiskmanager, included in the freely available VMware Server.

$ vmware-vdiskmanager -r <Name of split vmdk base file> -t 0 <Name of new single vmdk file>

IMPORTANT: before converting the disk files into a single disk file, you must first remove all snapshots (through the web interface if you were using VMware Server 2.0). Otherwise your merged disk will not be in the latest known state. Removing these snapshots can take quite some time, after which *-000001.vmdk - type of files may have disappeared from the file system.

To create a new virtual machine from an existing file, call virt-install with the --import argument (see the virt-install manpage for details).

To use a .vmdk disk in an existing virtual machine, modify the VM's XML file in /etc/libvirt/qemu:

 ...
<disk type='file' device='disk'>
<driver name='qemu' type='vmdk'/>
<source file='/var/lib/libvirt/images/diskname.vmdk'/>
<target dev='hda' bus='ide'/>
</disk>
...

and redefine it:

$ virsh -c qemu:///system define NameOfMachine.xml

IMPORTANT: keep in mind that while the .vmx file is converted to .xml, the disks are used as-is. Please make backups, especially if you want to use the virtual machine in VMware later.

KVM is not able to make snapshots when using vmdk disk files, so converting the virtual disk file in qemu's qcow2 format is advisable. The qemu package contains a utility named qemu-img to do this:

qemu-img convert diskname.vmdk -O qcow2 diskname.qcow2
OR for raw
qemu-img convert diskname.vmdk -O raw diskname.raw

The converted image can be used as part of the definition of a new VM, or incorporated into an existing VM (see above). Adding the disk through virt-manager will always add it as a raw disk, so you will need to edit the xml as follows below to make sure it works with qcow2. The important bit is type='qcow2' instead of type='raw'!

...
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/.../diskname.qcow2'/>
<target dev='hdb' bus='ide'/>
</disk>
...

Should VMware Tools be kept after conversion?

If converting from vmware to libvirt, be sure to remove vmware-tools if you have it installed (otherwise it will overwrite xorg.conf on reboot)

VMDK镜像迁移到KVM(二)的更多相关文章

  1. VMDK镜像迁移到KVM

    The vmware system consists of two disks in raw format: the old boot disk and the second one. It is W ...

  2. 笔记:Xen虚拟机如何迁移到KVM上?

    众所周知如果是在Linux上使用虚拟化技术的话,就会有基于Xen Hypervisor部署一个系统的机会.因为基于内核的虚拟机(KVM:Kernel-Based Virtual Machine)已经逐 ...

  3. 阿里云开源 image-syncer 工具,容器镜像迁移同步的终极利器

    为什么要做这个工具? 由于阿里云上的容器服务 ACK 在使用成本.运维成本.方便性.长期稳定性上大大超过公司自建自维护 Kubernets 集群,有不少公司纷纷想把之前自己维护 Kubernetes ...

  4. 【电子取证:镜像仿真篇】Windows Server镜像仿真、vmdk镜像仿真

    Windows Server镜像仿真.vmdk镜像仿真 时间过得真快呀!--[suy999] Windows Server镜像仿真.vmdk镜像仿真 一.qemu-img镜像转换工具 (一)raw.q ...

  5. SQL Server 2008 数据库镜像部署实例之二 配置镜像,实施手动故障转移

    SQL Server 2008 数据库镜像部署实例之二 配置镜像,实施手动故障转移 上一篇文章已经为配置镜像数据库做好了准备,接下来就要进入真正的配置阶段 一.在镜像数据库服务器上设置安全性并启动数据 ...

  6. 如何把Composer镜像迁移到Laravel China 维护的镜像?

    今天在更新Laravel-admin:1.6.0提示没有对应的包,后面才发现需要使用官方或者 Laravel-China 的 composer 镜像,phpcomposer 镜像已经停止维护了.怎么从 ...

  7. Mac环境下扩容 .vmdk 镜像容量

    参考: Resizing a VirtualBox Disk Image (.vmdk) on a Mac Mac环境下扩容 .vmdk 镜像容量 在安装虚拟机时,原有的vmdk镜像容量只有20G,在 ...

  8. vmware磁盘文件(vmdk)迁移

    原因:由于虚拟机安装时硬盘分配20G,随着虚拟机数据增多,磁盘占用也增多.磁盘总可用空间不能满足虚拟机数据增多.虽然虚拟机数据还没到20G,但磁盘总可用空间小,导致虚拟机继续运行时报空间不足. 解决办 ...

  9. 使用nodejs+ harbor rest api 进行容器镜像迁移

    最近因为基础设施调整,需要进行harbor 镜像仓库的迁移,主要是旧版本很老了,不想使用,直接 打算部署新的,原以为直接使用复制功能就可以,但是发现版本差异太大,直接失败,本打算使用中间 版本过度进行 ...

随机推荐

  1. VBA SQLServer 基本操作

      读取MS SQL Server数据表数据,并将它保存到excel工作表中 Sub ReturnSQLrecord() 'sht 为excel工作表对象变量,指向某一工作表 Dim i As Int ...

  2. Linux CC攻击脚本

    CC(ChallengeCollapsar)主要是用来攻击页面的.大家都有这样的经历,就是在访问论坛时,如果这个论坛比较大,访问的人比较多,打开页面的速度会比较慢,访问的人越多,论坛的页面越多,数据库 ...

  3. Ubuntu里面的安装命令总结

    本人是新手中的新手,才开始用ubuntu.下面,总结一下安装软件的方法...... 0. 利用apt-get 其实,在ubuntu下安装软件的方法其实灰常简单.就是在终端里面输入: sudo apt- ...

  4. 发送有序广播Ordered Broadcast

    import android.os.Bundle;import android.app.Activity;import android.content.Intent;import android.vi ...

  5. 一天完成把PC网站改为自适应!原来这么简单!

    http://www.webkaka.com/blog/archives/how-to-modify-a-web-page-to-be-responsive.html 一天完成把PC网站改为自适应!原 ...

  6. dancing link模板

    #include<cstdio> #include<iostream> #include<cstring> #include<algorithm> #i ...

  7. [转]powerDesigner生成excel版本的数据库文件

    powerDesigner生成excel版本的数据库文件 出处:http://ray-allen.iteye.com/blog/1893347 脚本 excel  今天收到一个需求,要把数据库设计给一 ...

  8. 基于K2 BPM的航空业核心业务管理解决方案

    基于K2 BPM平台的航空业解决方案,专注航空公司运行类.营销类.管理类所有解决方案. 查看完整版,请访问K2官网http://www.k2software.cn/zh-hans/aviation-i ...

  9. 网易云课堂 OCP

    数据库DBA任务: 管理数据库可用性 设计并创建数据库 管理物理结构 管理基于设计的存储 管理安全性 网络管理 备份与恢复 数据库调整与优化 关系型数据库(RDBMS) 多个表数据之间存在着关系 关系 ...

  10. java应用程序和虚拟机实例之间的关系

    每一个java程序都会产生一个java虚拟机的实例.并不是说一个物理机上,运行多个java应用程序就只有一个java虚拟机实例,多少个java应用程序就有多少个java虚拟机实例.