From owner-freebsd-hackers Thu Apr 3 10:42:11 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id KAA08050 for hackers-outgoing; Thu, 3 Apr 1997 10:42:11 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.50]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id KAA08042 for ; Thu, 3 Apr 1997 10:42:05 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id LAA16584; Thu, 3 Apr 1997 11:24:38 -0700 From: Terry Lambert Message-Id: <199704031824.LAA16584@phaeton.artisoft.com> Subject: Re: Making holes in files with lseek() To: ssigala@globalnet.it (S Sigala) Date: Thu, 3 Apr 1997 11:24:38 -0700 (MST) Cc: freebsd-hackers@freebsd.org In-Reply-To: from "S Sigala" at Apr 3, 97 04:08:41 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > Hello, i have just written this little program that replaces sequences > of nul bytes with holes (using lseek()). This seem to work, but i would > like to know the ideal length of the nul bytes sequence where a hole is > better (requires less space on disk) than the sequence. > In other words, how much disk space is wasted by a hole? Does every > lseek() call (a seek below the end of the file) create a hole? > > Thanks in advance. This requires that there be enough space for the file and a "holified" version of the file. I think one could use a script containing a tar in of the source file and a tar out of the destination file, using the "--sparse" or "-S" argument, and achieve the same effect... May I suggest implementing F_FREESP for fcntl(2) instead, and operating on the existing file? This would allow you to make an existing file sparse by "marking" holes with F_FREESP. Regards, Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.