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. 斐波那契博弈(Fibonacci Nim)

    问题: 有一堆个数为n(n>=2)的石子,游戏双方轮流取石子,规则如下: 1)先手不能在第一次把所有的石子取完,至少取1颗: 2)之后每次可以取的石子数至少为1,至多为对手刚取的石子数的2倍. ...

  2. java之io之file类的常用操作

    java io 中,file类是必须掌握的.它的常用api用法见实例. package com.westward.io; import java.io.File; import java.io.IOE ...

  3. HookSSDT 通过HookOpenProcess函数阻止暴力枚举进程

    首先要知道Ring3层调用OpenProcess的流程 //当Ring3调用OpenProcess //1从自己的模块(.exe)的导入表中取值 //2Ntdll.dll模块的导出表中执行ZwOpen ...

  4. WEBService动态调用代码

    BasicHttpBinding bind = new BasicHttpBinding(); bind.MaxReceivedMessageSize = int.MaxValue; Endpoint ...

  5. CF 103E Buying Sets 最大权闭合子图,匹配 难度:4

    http://codeforces.com/problemset/problem/103/E 这道题首先一看就很像是最大权闭合子图,但是我们可以认为现在有两种点,数字和集合点,我们需要消除数字点的影响 ...

  6. c# datagridview按条件搜索查询过滤

    DataView的RowFilter 实现过滤 根据文本框文字对datagridview的数据进行模糊查询, 其实也就是一个过滤 string qymc = textBox1.Text.ToStrin ...

  7. 简易模仿手机拨号盘浮在ListView之上并且展开,折叠效果

    2013-12-24 16:56:45 有时候可以看到很多手机会将Call log list和Dailer放在同一个页面中,同时Dialer是可以折叠.打开的,自己做了一个Demo,能实现这种效果,简 ...

  8. C/C++类型转换总结

    ---恢复内容开始--- 最近做笔试题经常会碰到有关类型转换的题型,所以结合例子做下总结,也是希望自己能更时刻的理解类型转换. C++的类型转换包括内置类型和类类型对象的转换. (1) 1.1隐式类型 ...

  9. [Swift2.0系列]Defer/Guard 基础语法

    1.Defer Swift2.0中加入了defer新语法声明.defer译为延缓.推迟之意.那么在Swift2.0中它将被应用于什么位置呢?比如,读取某目录下的文件内容并处理数据,你需要首先定位到文件 ...

  10. Cisco IOS Software Activation Command Reference

    clear license agent : to clear license agent statistics counters or connection statistics (in privil ...