From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Richard W.M. Jones" Subject: Re: Making discard/fstrim reliable Date: Thu, 3 Apr 2014 18:23:11 +0100 Message-ID: <20140403172311.GQ1302@redhat.com> References: <20140326204708.GA29191@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-fsdevel@vger.kernel.org, pbonzini@redhat.com To: =?utf-8?B?THVrw6HFoQ==?= Czerner Return-path: Received: from mx1.redhat.com ([209.132.183.28]:56376 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752775AbaDCRXN (ORCPT ); Thu, 3 Apr 2014 13:23:13 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s33HNCIU002611 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 3 Apr 2014 13:23:13 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Apr 03, 2014 at 07:08:34PM +0200, Luk=C3=A1=C5=A1 Czerner wrote= : > All that said, while discard is a interesting functionality and can > be abused in many _many_ ways. It looks like what you really need is > something that is currently available in fallocate(1) from > util-linux package. The option to look for is --dig-holes: >=20 > -d, --dig-holes > Detect and dig holes. Makes the file sparse in-place, without= using extra disk space. > The minimal size of the hole depends on filesystem I/O block si= ze (usually 4096 bytes). > Also, when using this option, --keep-size is implied. >=20 > You can think of this as doing a "cp --sparse" and renaming the= dest file as the origi=E2=80=90 > nal, without the need for extra disk space. This applies to single host files right? virt-sparsify takes a disk image and sparsifies it, by examining the internals of the disk image to find unused space (not *zero* space, but space that's unused -- it could contain deleted files or other garbage). Rich. --=20 Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~= rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html