From owner-freebsd-fs@freebsd.org Thu Sep 28 20:16:45 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 B87F1E08321 for ; Thu, 28 Sep 2017 20:16:45 +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 1714C6CAEC for ; Thu, 28 Sep 2017 20:16:45 +0000 (UTC) (envelope-from ben.rubson@gmail.com) Received: by mail-wr0-x22c.google.com with SMTP id z39so4729744wrb.8 for ; Thu, 28 Sep 2017 13:16:45 -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:message-id:references:to; bh=6Xs2JrRrbmUPcFf0nX75jSNj8LCrIDcBL5EE2WVMUrw=; b=uKoQun8U/BgAnkENL51lL0dgqxT58K3590GyEADLU3ykybF3D4nIRc/6O9EIJVwbTh lyDfx3jBxKbmSPKrIQViuvmOJ91JkWpH/mpgIYY8XEMfK+g+5jDd2yKsYkxaUL4WHJBN 3SohW9FgaSJE/d7DzVk6h5lHxg+VRRj5Rx6LgkeapgSWKLPoJz9OM4esX3bilmkVvZtp PQJH4VQ+avi9i8VoXt4Cu+HLUCBehkGbJbhM9ybHtJkymOip07OGSPDawlwx1P2OSv+F OULPSySSxnRgZxm1MiZAM1oFIbd+wwyHQ7fVlEgS0wkiqwuAXeAWU2Da89j0M6OSleJG hmzg== 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 :message-id:references:to; bh=6Xs2JrRrbmUPcFf0nX75jSNj8LCrIDcBL5EE2WVMUrw=; b=hjLc5/rYhhevp1dCC4A+GMoWlhRrAmG3oGGeOU9Zs2ca50VmwM5KzrNjGrlLRRBYw8 q9ea932bM61icy+1sA/d3/D3hgb+6rM9UD3eF9xV/yL7HOaU1aWNM0fHicReRtsgUHLC qdzbqZzjRLPBao+/DO1CLXC58l2MQ/wpFrtAb7EnO37/7+BdOYRJoMtGwrAaZ5HXZAc8 A6Kn0FKjDFbpSHrSUEHwoPpO+znK53NU4tx8Puqj+PaGKGt1BfG3SXZzsTcAzyWopOHA Gr5QyOIlvej3DdAIul/qUEntWawYqR8bkdrAqRbw9ftiKpNIvzSY0kuNjj8xmPfYi1sr TNgQ== X-Gm-Message-State: AHPjjUjG6NNW6OBP1pBWT1MggoVB/Ub49YHv97JFNCPEgRWjU5cv4u/O hWkgANifmhtkoR+tq1c/ZwCSWLMf X-Google-Smtp-Source: AOwi7QC/b/Hhq3foFdJVk9vkMSnF4w32kNXQq7TgST6w3ewQ5dzpJfdXn9dE8VH9XPEzvYO6Ho9sIg== X-Received: by 10.223.157.203 with SMTP id q11mr5307684wre.96.1506629802902; Thu, 28 Sep 2017 13:16:42 -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 b190sm1688292wma.41.2017.09.28.13.16.41 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Sep 2017 13:16:42 -0700 (PDT) Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: How to create holes in files ? From: Ben RUBSON X-Priority: 3 In-Reply-To: <12ed413d-00d1-4182-bdd5-0e5230d46f01@email.android.com> Date: Thu, 28 Sep 2017 22:16:40 +0200 Message-Id: <4D304428-E4AF-45D4-AB2E-D4B73A7FEE87@gmail.com> References: <12ed413d-00d1-4182-bdd5-0e5230d46f01@email.android.com> To: Freebsd fs X-Mailer: Apple Mail (2.3124) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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: Thu, 28 Sep 2017 20:16:45 -0000 > On 28 Sep 2017, at 20:48, Karli Sj=C3=B6berg = wrote: >=20 > Den 28 sep. 2017 6:47 em skrev Ben RUBSON : > > On 28 Sep 2017, at 18:34, Bob Eager wrote: > >=20 > > On Thu, 28 Sep 2017 17:26:09 +0200 > > Fabian Keil wrote: > >=20 > >> Ben RUBSON wrote: > >>=20 > >>> I'm trying to make holes in files in C. > >>> Goal is to deallocate huge files on ZFS while (randomly) reading > >>> them.=20 > >>=20 > >> My interpretation of the above is that you want to create holes > >> without changing the file size and without affecting data that > >> is located before or after the holes that you want to create. > >>=20 > >> Otherwise you could simply "deallocate" the content with > >> truncate(1). > >=20 > > If he doesn't mind copying the files, dd(1) will do the job. = However, I > > expect that doesn't meet his criteria. >=20 > Thank you Bob for your suggestion. > You're right goal is to avoid copying data : free space would not = necessarily > allow this, and as the files I'm working on are some hundreds of GB in = size, > it would really be a counterproductive long stressing storage = operation. >=20 > Well, correct me if I'm wrong, but wouldn't dd with "seek" mitigate = the issue of writing out all of the data from beginning to end. If you = seek from the beginning of the file to the point you want to start = writing from and use bs to specify how large of a "hole" you want, the = operation wouldn't take long at all. You would, in my opinion, achieve = exactly what you want, to "create holes in files". Am I wrong? I would have liked to do this in C. And the holes I need to create are not necessarily at the beginning of a = file. I randomly read parts of huge input files that I need to "free" on the = fly to recover storage space for the output files. Ben