From owner-freebsd-fs@freebsd.org Fri Sep 29 07:32:02 2017 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 6A177E25C98 for ; Fri, 29 Sep 2017 07:32:02 +0000 (UTC) (envelope-from ben.rubson@gmail.com) Received: from mail-wr0-x22c.google.com (mail-wr0-x22c.google.com [IPv6:2a00:1450:400c:c0c::22c]) (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 EF9C48171D for ; Fri, 29 Sep 2017 07:32:01 +0000 (UTC) (envelope-from ben.rubson@gmail.com) Received: by mail-wr0-x22c.google.com with SMTP id r74so833252wrb.13 for ; Fri, 29 Sep 2017 00:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=kVHsxbixiwVRfGiSXHFJmkwEeJDS6xLdczq/oyvqjts=; b=n4unpW+OODTJHpxYavZSOJzhA5wTNQPIm9fvOMDrLkLHppHn2LQ6iwak0YMM+XcBrn 8rxFp4Jtzig/cPDB/F7i7pRX8P/RgE9zTIA6LI+K2PluPMR2n3Is4yHZ6HEBPxmiEk3A 3dA8+HJPsXjLvc5PQMzZWJXjSRVGw0BZyoFNQiMJM3j7W6FZ9Elld8AxBDvmLpsAPx0j iguUHcEx6vJly+FgXTPLnL2uxudi3evjMujAQbNJK0Q3t/dgjiyA8vV+QQNezHRrVpjj dsmiXHhnvwzaDrI2viPpgDF0Un9gurLmR2I8sjtuBQConUXhh5gSZCThuchzaHgx7Vi3 JnGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=kVHsxbixiwVRfGiSXHFJmkwEeJDS6xLdczq/oyvqjts=; b=Zx8BcgHXLh68IOL8C7CQIKgL3rZeC9C3QMs8eIwgKq5r2AdLlDtvMQu3ttJeskUQip Kd7nt9LaUTLZrMHxRp9VNNvY8HYbnTUsazANNyfQfb+3UiV8iLNlO661taI8JShq8H5D /AwIo4TKzwS/vd/2OdLE0y75VoZ/ZRKQICekIWQVEGufcZCIrEMTEioz7Zzjw0c+poqa CcYKmNCRlUmLpOKCIH7fwJUYimT4yyygRujc4QG2tyFyw4Q9b1n9XNsBBNzZoQX/cQ8Z WpxD3cSaBLVskuThN7xpRRBv7A1vAF2gtAjXKJtOqLZkp6icaMpDzgjNOcjt37B2wB5j kwHg== X-Gm-Message-State: AHPjjUgnbaf5hnK2hje2cWReJ16wc7ZI8uaaV8+hU/2ntisTntMKI2G9 HsI/D3o1mVmGJJAP/+jKxXZU3B7y X-Google-Smtp-Source: AOwi7QDTvEDb+cb1UcVh6QG9PTDgRwfxHK85q+pOcOfuCKp/K9epcgkQl26HlIIRY8aCJh8fnFdt6Q== X-Received: by 10.223.174.227 with SMTP id y90mr6609648wrc.205.1506670320105; Fri, 29 Sep 2017 00:32:00 -0700 (PDT) Received: from bens-mac.home (LFbn-MAR-1-445-220.w2-15.abo.wanadoo.fr. [2.15.38.220]) by smtp.gmail.com with ESMTPSA id n9sm4038925wmd.12.2017.09.29.00.31.59 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Sep 2017 00:31:59 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: How to create holes in files ? From: Ben RUBSON In-Reply-To: <20170929080823.175d6abc@raksha.tavi.co.uk> Date: Fri, 29 Sep 2017 09:31:58 +0200 Content-Transfer-Encoding: 7bit Message-Id: <7E8BB109-C72C-4B5D-A2EF-630C6B34D8E6@gmail.com> References: <12ed413d-00d1-4182-bdd5-0e5230d46f01@email.android.com> <4D304428-E4AF-45D4-AB2E-D4B73A7FEE87@gmail.com> <1506664468.7204.37.camel@inparadise.se> <454261D6-0061-4DB9-8184-BDD7061870FB@gmail.com> <20170929080823.175d6abc@raksha.tavi.co.uk> To: Freebsd fs X-Mailer: Apple Mail (2.3124) 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: Fri, 29 Sep 2017 07:32:02 -0000 > On 29 Sep 2017, at 09:08, Bob Eager wrote: > > On Fri, 29 Sep 2017 08:26:13 +0200 > Ben RUBSON wrote: > >> Unfortunately here storage blocks will be set/written to 0, >> they will not be freed/recovered, a file hole will not be created. > > You need to add: conv=sparse to the dd command to turn zero blocks > into unallocated blocks. You're right Bob it works : # dd if=/dev/random of=f bs=1M count=4 4+0 records out # zfs userspace home POSIX User root 4.04M none # dd if=/dev/zero of=f bs=1M count=2 seek=2 conv=sparse 2+0 records out # zfs userspace home POSIX User root 2.04M none # ls -lh f -rw------- 1 root wheel 4.0M 29 Sep 09:25 f Unfortunately, using "conv=notrunc,sparse" to make a hole in the middle of a file does not seem to work, file is truncated : # rm f # dd if=/dev/random of=f bs=1M count=4 4+0 records out # dd if=/dev/zero of=f bs=1M count=1 seek=2 conv=notrunc,sparse 1+0 records out # ls -lh f -rw------- 1 root wheel 3.0M 29 Sep 09:26 f # zfs userspace home POSIX User root 3.04M none Anyway thank you for this tip, this is something to analyse ! Ben