From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4D4C2B3A.3010704@redhat.com> Date: Fri, 04 Feb 2011 16:37:14 +0000 From: "Bryn M. Reeves" MIME-Version: 1.0 References: <4D4C0933.80107@redhat.com> <20110204155403.GD1535@redhat.com> In-Reply-To: <20110204155403.GD1535@redhat.com> Content-Transfer-Encoding: 7bit Subject: Re: [linux-lvm] lvm2: zeroing free space Reply-To: LVM general discussion and development List-Id: LVM general discussion and development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , List-Id: Content-Type: text/plain; charset="us-ascii" To: LVM general discussion and development Cc: Mike Snitzer On 02/04/2011 03:54 PM, Mike Snitzer wrote: > On Fri, Feb 04 2011 at 9:12am -0500, > Bryn M. Reeves wrote: > >> Hi Folks, >> >> Recently had a query from someone using an array supporting thin provisioning >> with zero page reclaim[1]. >> >> They wanted a method to write zeros to all the unallocated space in a VG to >> trigger a reclaim of unused regions in the VG's PVs. >> >> My suggestion was to lvcreate a -l100%FREE LV named "filler" and overwrite it >> from /dev/zero. >> >> It seems like this might something a lot of users want as this functionality >> gets to be more common. >> >> I wondered if it could be worth adding a script to automate this or even an >> option to vgchange (e.g. --zero-free-space)? >> >> Didn't have time to try putting anything together yet but it seems such a >> feature could be useful. > > Do these HDS arrays also support discard? Would seem to me that issuing > discards for the free space would be better (more standard) than writing > zeros to accomplish the same. > > This variant would be: vgchange --discard-free-space There are two variants of reclamation currently supported by external storage products. The WRITE_SAME/TRIM based explicit discard support is superior when the entire storage stack supports it and I agree it would be good to support this mode of reclaim too (superior in that you lose the zero-write overhead and associated reclaim lag and can get better space utilisation since the host "knows" better which blocks are unused). Several vendors (at least HDS/EMC that I know of) also support an implicit reclaim mode known as zero page/space reclaim in which the storage de-allocates blocks that are overwritten with zeros. I suppose the ideal solution would be to detect whether the storage supports one or the other automatically but I don't know that there is a way to achieve this right now (TRIM/WRITE_SAME possibly but I think the zero page stuff is entirely transparent). Regards, Bryn.