From owner-freebsd-questions Fri Dec 13 5:41:44 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 92CFF37B401 for ; Fri, 13 Dec 2002 05:41:43 -0800 (PST) Received: from HAL9000.homeunix.com (12-232-220-15.client.attbi.com [12.232.220.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id E578443E4A for ; Fri, 13 Dec 2002 05:41:42 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id gBDDffnZ005113; Fri, 13 Dec 2002 05:41:41 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id gBDDffkN005112; Fri, 13 Dec 2002 05:41:41 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Date: Fri, 13 Dec 2002 05:41:41 -0800 From: David Schultz To: Andre Albsmeier Cc: freebsd-questions@FreeBSD.ORG Subject: Re: How to truncate a file in the beginning Message-ID: <20021213134141.GA5045@HAL9000.homeunix.com> Mail-Followup-To: Andre Albsmeier , freebsd-questions@FreeBSD.ORG References: <20021213141110.A99587@curry.mchp.siemens.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021213141110.A99587@curry.mchp.siemens.de> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thus spake Andre Albsmeier : > 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