From owner-freebsd-fs@freebsd.org Tue Dec 13 09:59:39 2016 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DE94C70594 for ; Tue, 13 Dec 2016 09:59:39 +0000 (UTC) (envelope-from crest@rlwinm.de) Received: from smtp.rlwinm.de (smtp.rlwinm.de [IPv6:2a01:4f8:201:31ef::e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BE301FE9 for ; Tue, 13 Dec 2016 09:59:39 +0000 (UTC) (envelope-from crest@rlwinm.de) Received: from crest.local (unknown [87.253.189.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.rlwinm.de (Postfix) with ESMTPSA id E31245AF0 for ; Tue, 13 Dec 2016 10:59:36 +0100 (CET) Subject: Re: Re-sparse a file-backed IO device + zfs To: freebsd-fs@freebsd.org References: From: Jan Bramkamp Message-ID: <43b81c7e-8a7b-73f4-0a13-5c91c92663b6@rlwinm.de> Date: Tue, 13 Dec 2016 10:59:36 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Dec 2016 09:59:39 -0000 On 13/12/2016 07:54, Karli Sjöberg wrote: > > Den 13 dec. 2016 02:20 skrev javocado : >> >> Hi, >> >> I'm setting up a bhyve wherein: >> >> host # truncate -s 1T vol.file >> host # du -ah vol.file >> 200K vol.file >> >> host # /usr/sbin/bhyve ... -s 4,ahci-hd,vol.file ... >> >> Then inside the bhyve I create a zpool (ada0 = vol.file): >> >> bhyve # zpool create -O devices=off -O atime=off -O compression=on -m >> /mnt/data1 data1 ada0 >> >> And I put a bunch of stuff in the zpool ... and the vol.file grows in size: >> >> host # du -ah vol.file >> 100G vol.file >> >> Then I remove the files from the zpool and the zpool usage returns to 0 but >> of course the vol.file size does not shrink, the data is still there (but >> not referenced?) >> >> Normally I'd just write zeros to a file inside the zpool until the pool >> fills up, then maybe cp --sparse vol.file for good measure, but with >> compression on in the zpool the zeroing doesn't really fill up space or >> seem to overwrite anything. In my testing the zero file grew larger than >> 100G with no change to vol.file I did not let it run forever, however. >> >> Any other ideas how to scrub off or clear out deleted data from a zpool >> and/or this kind of file-backed device? > > Wouldn't you have needed TRIM on the disk(s) inside the VM and it would have taken care of all this for you? The ahci-hd driver supports TRIM on ZFS volumes. Why do you use sparse file instead of a ZFS volume?