Date: Fri, 13 Dec 2002 05:41:41 -0800 From: David Schultz <dschultz@uclink.Berkeley.EDU> To: Andre Albsmeier <andre.albsmeier@mchp.siemens.de> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: How to truncate a file in the beginning Message-ID: <20021213134141.GA5045@HAL9000.homeunix.com> In-Reply-To: <20021213141110.A99587@curry.mchp.siemens.de> References: <20021213141110.A99587@curry.mchp.siemens.de>
next in thread | previous in thread | raw e-mail | index | archive | help
Thus spake Andre Albsmeier <andre.albsmeier@mchp.siemens.de>: > Are there any special features in FreeBSD that I can use > to truncate a file in the beginning? > > Let's assume I have a 50GB file. Only the last 10GB are > interesting for me and I have to free the first 40GB for > some reason. Of course, I could seek to the appropriate > position and copy the 10GB to a new file and unlink the > old one. The problem is that I don't have a lot of time > to do this so I am looking for something like ftruncate() > but for the beginning... Nope, you have to copy the data. Technically something like this could be implemented by copying metadata only, but it would only work if the amount you want to snip is a multiple of the filesystem's block size. However, it's a lot of work for a rather uncommon case; even ftruncate() is used infrequently. Perhaps you could devise a scheme for striping your data across multiple 10GB files. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021213134141.GA5045>