From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [User Question] How to create a backup of an LVM based maschine without wasting space Date: Thu, 18 Oct 2012 14:57:41 +0200 Message-ID: <507FFCC5.5050508@redhat.com> References: <5077BE30.5010209@laukamp.me> <20121012084221.GC14822@stefanha-thinkpad.redhat.com> <5077DB9F.6050809@laukamp.me> <5077E03E.2040507@laukamp.me> <5077EDEB.6050703@laukamp.me> <5077F600.7080809@laukamp.me> <50785DEE.6060204@laukamp.me> <50786EEC.2030507@laukamp.me> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Lukas Laukamp , kvm@vger.kernel.org To: Stefan Hajnoczi Return-path: Received: from mx1.redhat.com ([209.132.183.28]:24028 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755068Ab2JRM5r (ORCPT ); Thu, 18 Oct 2012 08:57:47 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 10/12/2012 10:43 PM, Stefan Hajnoczi wrote: >> >> the VM is called mailer and I used this command: qemu-img convert -f raw -c >> -O qcow2 /dev/vmdisks/mailer ./vmachines/mailer.qcow2 >> >> Im on the /mnt dir because it's a seperate HDD with the folder vmachines. >> >> Thats the output of qemu-img info: >> >> image: ./vmachines/mailer.qcow2 >> file format: qcow2 >> virtual size: 5.0G (5368709120 bytes) >> disk size: 4.1G >> cluster_size: 65536 >> >> I checked the info of the fs inside the guest. The / partition is 4,7GB big >> and 1,2GB are used. The fs is ext3. > > I wonder if you see better results without the -c option. Since the image is on a logical volume, it may not have been cleared prior to use by the guest; or the guest is busy enough that it has overwritten all the blocks in the image. You can try a manual trim by creating a large file in the guest consisting of all zeros, then deleting it: dd < /dev/zero < /zeroes rm zeroes Afterwards you'll get a much smaller qcow image. Of course this requires working within the guest, and there is the risk of disrupting the guest by reaching the ENOSPC condition. -- error compiling committee.c: too many arguments to function