Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Dec 2002 14:45:19 +0100
From:      Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
To:        Andre Albsmeier <andre.albsmeier@mchp.siemens.de>, freebsd-questions@FreeBSD.ORG
Subject:   Re: How to truncate a file in the beginning
Message-ID:  <20021213144519.A2156@curry.mchp.siemens.de>
In-Reply-To: <20021213134141.GA5045@HAL9000.homeunix.com>; from dschultz@uclink.Berkeley.EDU on Fri, Dec 13, 2002 at 05:41:41AM -0800
References:  <20021213141110.A99587@curry.mchp.siemens.de> <20021213134141.GA5045@HAL9000.homeunix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 13-Dec-2002 at 05:41:41 -0800, David Schultz wrote:
> 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.

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021213144519.A2156>