From owner-freebsd-questions Fri Dec 13 5:45:23 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 4012F37B401 for ; Fri, 13 Dec 2002 05:45:22 -0800 (PST) Received: from david.siemens.de (david.siemens.de [192.35.17.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1144243E4A for ; Fri, 13 Dec 2002 05:45:21 -0800 (PST) (envelope-from andre.albsmeier@mchp.siemens.de) Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by david.siemens.de (8.11.6/8.11.6) with ESMTP id gBDDjK107653 for ; Fri, 13 Dec 2002 14:45:20 +0100 (MET) Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.42.7]) by mail1.siemens.de (8.11.6/8.11.6) with ESMTP id gBDDjJc11814 for ; Fri, 13 Dec 2002 14:45:19 +0100 (MET) Received: (from localhost) by curry.mchp.siemens.de (8.12.6/8.12.6) id gBDDjJUY080967; Date: Fri, 13 Dec 2002 14:45:19 +0100 From: Andre Albsmeier To: Andre Albsmeier , freebsd-questions@FreeBSD.ORG Subject: Re: How to truncate a file in the beginning Message-ID: <20021213144519.A2156@curry.mchp.siemens.de> References: <20021213141110.A99587@curry.mchp.siemens.de> <20021213134141.GA5045@HAL9000.homeunix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20021213134141.GA5045@HAL9000.homeunix.com>; from dschultz@uclink.Berkeley.EDU on Fri, Dec 13, 2002 at 05:41:41AM -0800 X-Echelon: SSL, AA, Espionage, PBX, SHF 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 On Fri, 13-Dec-2002 at 05:41:41 -0800, David Schultz wrote: > 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. Hmm, that's bad news :-). Thanks anyway, now I know that I have to figure out something differently. Maybe I will create lots of, let's say, 100MB files and manage them myself... Thanks, -Andre To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message