Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!hp4nl!ctisbv!pim From: pim@cti-software.nl (Pim Zandbergen) Newsgroups: comp.unix.questions Subject: F_FREESP argument to fcntl() (was: Re: sparse files) Message-ID: <1650@ctisbv.cti-software.nl> Date: 10 Dec 89 16:19:52 GMT References: <21581@adm.BRL.MIL> <235@dg.dg.com> <2700@auspex.auspex.com> Organization: CTI Software BV, The Hague, the Netherlands Lines: 27 guy@auspex.auspex.com (Guy Harris) writes: >>Once an area of a file is written, >>it cannot be returned to its previous sparse state. >Not in general, anyway. At least the first version of AIX for the RT PC >claimed, in its documentation, that it had an "fclear()" call to punch >holes in files; I think this may show up in future releases of other >UNIXes as well. I think the *undocumented* F_FREESP argument to fcntl() in lots of versions of SYSVR3 can do this too. Take a look in /usr/include/sys/fcntl.h to find out if yours has it. Some time ago somebody posted a SYSV implementation of ftruncate(). It used F_FREESP to chop off the end of a file. But I see no reason why it could not be used to punch a hole in the middle of a file. Can anybody confirm this? This could be the base of a handy tool able to free LOTS of disk space. -- Pim Zandbergen domain : pim@cti-software.nl CTI Software BV uucp : uunet!mcsun!hp4nl!ctisbv!pim Laan Copes van Cattenburch 70 phone : +31 70 3542302 2585 GD The Hague, The Netherlands fax : +31 70 3512837