From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tokarev Subject: Re: Using qemu-img to directly convert physical disk to KVM image Date: Tue, 09 Nov 2010 10:53:42 +0300 Message-ID: <4CD8FE06.5010907@msgid.tls.msk.ru> References: <4CD88744.7030502@msgid.tls.msk.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm To: Emmanuel Noobadmin Return-path: Received: from isrv.corpit.ru ([86.62.121.231]:59589 "EHLO isrv.corpit.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753099Ab0KIHxo (ORCPT ); Tue, 9 Nov 2010 02:53:44 -0500 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: 09.11.2010 05:54, Emmanuel Noobadmin wrote: > Thanks for the confirmation and just for the benefit of anybody else > who subsequently searches for KVM QEMU convert physical > drive virtual machine image , yes it works :) Heh. Well, it is not something unexpected really. Just a few more comments below... > On 11/9/10, Michael Tokarev wrote: >> 09.11.2010 01:48, Emmanuel Noobadmin wrote: >>> I'm trying to convert a physical Windows XP machine into a KVM guest. >>> All the guides so far mentions using dd to create a flat image file, >>> then using qemu-img to convert that to qcow2. Since I've been making >>> mistake here and there, retrying the process several times (initially >>> converting each logical partition into an image), the question struck >>> me: is there any reason why I cannot do something like this >>> qemu-img convert -f /dev/sdc -O qcow2 /images/winxp.qcow instead of >>> having to do it in two passes which literally take hours each. You mentioned several kinds of storage. The format of (virtual) drive can be raw or qcow2, or others supported by qemu. The location of the data can be in a file on a filesystem, or it can be a physical device (/dev/sdc), or a lvm volume, or a partition, or an iscsi lun, or any other block device. Either reasonable combination of the two can be used. In this case, running your guest off /dev/sda directly will work too. Moreover, you most likely does not want to convert it to a qcow2 format, due to various small and large issues with it - the "flat image file" created with dd, or a raw format created by `qemu-img -O raw' (which is almost the same but with zero blocks skipped) will most likely work better (read: faster and more reliable). /mjt