From owner-freebsd-virtualization@freebsd.org Tue Dec 13 01:25:22 2016 Return-Path: Delivered-To: freebsd-virtualization@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 B6CDBC74FB8 for ; Tue, 13 Dec 2016 01:25:22 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt0-x235.google.com (mail-qt0-x235.google.com [IPv6:2607:f8b0:400d:c0d::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70B10360 for ; Tue, 13 Dec 2016 01:25:22 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt0-x235.google.com with SMTP id c47so93749366qtc.2 for ; Mon, 12 Dec 2016 17:25:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Z3BWObFzyIeKTSrXcM227IZWryAiGZu/YM2FEOe0isY=; b=uatTZEL8zukKy4INkDUSWLfERUUjMdVhh7SMV2hO/EjIXEZAu+I+TLZyAh0bzqBxE1 R7hwN7ObWr7ECBFqR2lx+7bvB0K1x4+86h/v0NM9w6Os/1m/Y032EhxG3epe7AtFjQ6N JM/MSvfd5bcY/PIg5WhfsevXUm8CNyAkk43IfQzmDMHu56nUXXHi+L6pLl8ScJElwqp5 oBvC+2Vtd3U1i57WDqNcD/7ZZDmcxfP0wJhOEXjhQaLe+7YxvtxKAbu22yBrUrYMtTun 4N+JTrpAQZYKrMImyuDtr0hS7ugHVB12AluZvO146ebMkC1VDhOr0mFSmOYkYXnT0f+8 4Hew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Z3BWObFzyIeKTSrXcM227IZWryAiGZu/YM2FEOe0isY=; b=N9jIQ9zIW2NLX8/6NgwwaJYadPiwPnY6s5cFFoSLEuuavLW/0yBZD78jEQFs+XSWTR UHXPrGqJB9sUSLo42Mq39hDpUA5X9wis5qDqNsFHJ46Clq3+OpDxkzl50Fo48Rt2dPZQ yb+4fb75LM/CFkjqAKSJKDf3p95bwJji7FkEUbzOGAcCj0VO0kfsodW8cgCDDy1a+Kx9 zUjiedBoR1x3GkYzMzBcOpsmC9P2+AronYO7jiSECMtc+xOqUzyZXDxU/rlwEWbPdEsd +wekNArRaFhjVltccRQfoP6ET2iexkw55U+FvXpO+IogG2V0upqCvDWmiiQTRwSRQRer YxfQ== X-Gm-Message-State: AKaTC01i1z1IKx56t6cBq550KUKmK6dxr4oqSm4sYPI8XG78ARo5g8prX1LN8NMWXCkXpNmC X-Received: by 10.237.32.205 with SMTP id 71mr93387527qtb.237.1481592321577; Mon, 12 Dec 2016 17:25:21 -0800 (PST) Received: from mutt-hardenedbsd (pool-100-16-218-231.bltmmd.fios.verizon.net. [100.16.218.231]) by smtp.gmail.com with ESMTPSA id v18sm27867220qkb.40.2016.12.12.17.25.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Dec 2016 17:25:20 -0800 (PST) Date: Mon, 12 Dec 2016 20:25:18 -0500 From: Shawn Webb To: javocado Cc: freebsd-virtualization@freebsd.org, freebsd-questions@freebsd.org, FreeBSD Filesystems Subject: Re: Re-sparse a file-backed IO device + zfs Message-ID: <20161213012518.GA77233@mutt-hardenedbsd> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="J/dobhs11T7y2rNN" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD mutt-hardenedbsd 12.0-CURRENT-HBSD FreeBSD 12.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Dec 2016 01:25:22 -0000 --J/dobhs11T7y2rNN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 12, 2016 at 05:20:21PM -0800, javocado wrote: > Hi, >=20 > I'm setting up a bhyve wherein: >=20 > host # truncate -s 1T vol.file > host # du -ah vol.file > 200K vol.file >=20 > host # /usr/sbin/bhyve ... -s 4,ahci-hd,vol.file ... >=20 > Then inside the bhyve I create a zpool (ada0 =3D vol.file): >=20 > bhyve # zpool create -O devices=3Doff -O atime=3Doff -O compression=3Don= -m > /mnt/data1 data1 ada0 >=20 > And I put a bunch of stuff in the zpool ... and the vol.file grows in siz= e: >=20 > host # du -ah vol.file > 100G vol.file >=20 > Then I remove the files from the zpool and the zpool usage returns to 0 b= ut > of course the vol.file size does not shrink, the data is still there (but > not referenced?) >=20 > 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. >=20 > Any other ideas how to scrub off or clear out deleted data from a zpool > and/or this kind of file-backed device? Instead of dd'ing /dev/zero, try /dev/random. All zeros compress extremely well, [pseudo-]random data does (or, ideally, should) not. --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --J/dobhs11T7y2rNN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYT038AAoJEGqEZY9SRW7u1g0P/impDd7fVDSFcO5i/3wlf8M6 8tUs1sg53pJYSNDtEbIfiSODiJDwaXl4+Kdp7o4WbFP68HCzhHPr/qKB4GTyhSPD CgQRa9Jj90E+B7+/zSTba/b5axa30mfSeoVc0Ma1+id/Yq7J+rVEa951eXGCaE/5 bmkrPnWHilYfdRJLY2npVoVwjC44vxn3f1GlD06rrwTV+JCMaw6f7k6hkuAh9trg UyoCJftEH1hzcpyAWYVS4Wn+t/6bXFICKv+tpwDwm+epVkf6tIKvNNFEYxE+TFik PhTk5+i7Lz/12bR6Vh/hKiYKKxHa2rtYSA49TDBMeInOa5yCGQ6f98/Nz/MKc8d9 LUXUSovnVLZkMVObUK31dPF9TuZESK3SGRUTN6CzDArRIcl63xqRWevuv6Hk46Je vurBhvtN89ROzd/BZ10rISuGv+TlyY5MvykggZ7v1obB7nkukFnGQ3PKwmL2DHP5 h1AMc+NFQOU6ym/qcMVDqX/BBuzFBvkgLzZyOjh5wPNsq1ScuBBYO7yFBBwzcQRl rDLviLKBsUNsjHtOF38evqcbGYl19th92o6q4pWiE6hriO/WnaI6yI5WtfPHV7ta oefL87gBeb98YegBF2cCMmE+e0kulJta8qFZQC5bLcIQoBF8Nk9fBfMHUYiGlBxZ /iLIWlsGHOIQt86ev4Nt =wvAw -----END PGP SIGNATURE----- --J/dobhs11T7y2rNN--