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. sql server还原数据库文件(.bak)常见问题解决办法笔记

    还原的时候出现错误:备份集中的数据库备份与现有的数据库不同 SQL Server 2005数据库还原出错错误具体信息为:备份集中的数据库备份与现有的A数据库不同 具体操作如下:第一次:新建了数据库A, ...

  2. 解决ACTIVITI流程图设置字体不生效的问题

    在ACTIVITI 5.15的版本中,有一个设置流程图的字体配置. 配置如下: <bean id="processEngineConfiguration" class=&qu ...

  3. 原创:ASP.Net状态管理读书笔记--思维导图

    导图文件下载 课前提问几个问题 使用Session 配置 model aspnet_regsql.exe 常见问答 问:为什么Session在有些机器上偶尔会丢失?答:可能和机器的环境有关系,比如:防 ...

  4. java之socket

    socket系java中网络编程的内容. 1客户端: package com.wtd.socket; import java.io.BufferedReader; import java.io.IOE ...

  5. 如何理解java中的变量和常量

    int a =10;这是一个变量,在后面的代码中你可以去更改a的值但如果你在声明a的时候加上了final,那么a就成了常量,后面的代码是不允许对a做修改的.还有一点你要注意,被final修饰的常量必须 ...

  6. 转: HTTP协议的头信息详解

    通常HTTP消息包括客户机向服务器的请求消息和服务器向客户机的响应消息.这两种类型的消息由一个起始行,一个或者多个头域,一个只是头域结束的空行和可 选的消息体组成.HTTP的头域包括通用头,请求头,响 ...

  7. 火车安排问题(dp好题)

    火车站内往往设有一些主干线分叉出去的铁路支路,供火车停靠,以便上下客或装载货物.铁路 支路有一定长度:火车也有一定的长度,且每列火车的长度相等. 假设某东西向的铁路上,有一小站.该站只有一条铁路支路可 ...

  8. 数据结构-AVL树的旋转

    http://blog.csdn.net/GabrieL1026/article/details/6311339 平衡二叉树在进行插入操作的时候可能出现不平衡的情况,AVL树即是一种自平衡的二叉树,它 ...

  9. mysql 启动错误1026

    进入“事件查看器”“应用程序”果然发现很多MySql的错误Default storage engine (InnoDB) is not available 于是进入MySql的安装目录找到my.ini ...

  10. Windows的同步I/O和异步I/O

    同步I/O操作 执行步骤 1.        程序通过FileStream对象来打开磁盘文件,然后调用Read方法(内部调用Win32 ReadFile函数),从文件中读取数据.这时,线程从托管代码转 ...