Date: Thu, 28 Sep 2017 22:16:40 +0200 From: Ben RUBSON <ben.rubson@gmail.com> To: Freebsd fs <freebsd-fs@freebsd.org> Subject: Re: How to create holes in files ? Message-ID: <4D304428-E4AF-45D4-AB2E-D4B73A7FEE87@gmail.com> In-Reply-To: <12ed413d-00d1-4182-bdd5-0e5230d46f01@email.android.com> References: <12ed413d-00d1-4182-bdd5-0e5230d46f01@email.android.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> On 28 Sep 2017, at 20:48, Karli Sj=C3=B6berg <karli@inparadise.se> = wrote: >=20 > Den 28 sep. 2017 6:47 em skrev Ben RUBSON <ben.rubson@gmail.com>: > > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D304428-E4AF-45D4-AB2E-D4B73A7FEE87>