From: Matthew Palmer Subject: Re: ATA Trim for qcow(2) Date: Mon, 24 Jan 2011 10:25:36 +1100 Message-ID: <20110123232536.GA5673@hezmatt.org> References: <201101232235.50659.emil.langrock@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: kvm@vger.kernel.org Return-path: Received: from sasquatch.hezmatt.org ([70.85.129.92]:44700 "EHLO sasquatch.hezmatt.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752010Ab1AWXd3 (ORCPT ); Sun, 23 Jan 2011 18:33:29 -0500 Received: from hezmatt.org (unknown [10.6.66.6]) by sasquatch.hezmatt.org (Postfix) with ESMTP id 495E1D8C3 for ; Mon, 24 Jan 2011 10:25:42 +1100 (EST) Content-Disposition: inline In-Reply-To: <201101232235.50659.emil.langrock@gmx.de> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Jan 23, 2011 at 10:35:45PM +0100, Emil Langrock wrote: > there is support for ext4 to use the trim ATA command when a block is freed. I > read that there should be an extra command which does that freeing afterwards. > So is it possible to use that information inside the qcow to mark those > sectors as free? This would make it possible to shrink the size of an image > significantly using some offline (maybe also some online) tools. If the qemu block device can write zeroes out to TRIMmed space, a simple cp --sparse=always (on a raw image) can save all that zeroed space; I recall looking into this sort of thing a while ago and it was fairly simple to write a tool to wipe out the zero blocks in a qcow2 file, too. - Matt -- "The user-friendly computer is a red herring. The user-friendliness of a book just makes it easier to turn pages. There's nothing user-friendly about learning to read." -- Alan Kay