Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Aug 1998 15:23:15 -0400 (EDT)
From:      William Stearns <wstearns@pobox.com>
To:        moi <poipoi@famipow.com>
Cc:        freebsd-fs@FreeBSD.ORG, linux-fsdevel@vger.rutgers.edu
Subject:   Re: file hole ?
Message-ID:  <Pine.LNX.3.96.980804151525.6356W-100000@sparrow.websense.net>
In-Reply-To: <19980804175705.377.qmail@hwi.poi.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 4 Aug 1998 poipoi@famipow.com wrote:

> 	hi
> 
> 	i want to know how to handle file hole. 
> for example, i have a 8k file. i do a seek at 20000 and write a byte. 
> 
> Does the fs alloc every block to store 20001 bytes ?
> yes ? but its a space wasting...
> no ? but when the user will fill the hole (writing from 8192 to 20000),

	I can't speak for freebsd, but my best understanding about Linux'
ext2 filesystem is that yes, it supports what you're describing (commonly
known as "sparse" files).  Novell Netware does as well.  I'm not sure
whether this is a feature of the ext2 filesystem only or exists in Linux'
other filesystem implementations.
	This means that the uninitialized blocks of the file will not take
up physical space on disk.

> my fs will perhaps be full and i have to reject the write operation...

	I would guess that's correct.  On the other hand, if it didn't
support sparse files, you would not even have been able to create the file
in the first place.

> what is the standard (good?) behaviour ? and why (if possible) ?

	I consider this the preferred behaviour.  The case of running out
of disk space is just that, a _disk_ _space_ problem; an error writing to
a sparse file is only a symptom of the problem.  In fact, handling sparse
files delays the out-of-space condition, making it less likely to occur.
	Cheers,
	- Bill

---------------------------------------------------------------------------
Unix _is_ user friendly.  It's just very selective about who its friends 
are.  And sometimes even best friends have fights.
William Stearns (wstearns@pobox.com)
Mason, buildkernel, and named2hosts are at: http://www.pobox.com/~wstearns
---------------------------------------------------------------------------


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-fs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.3.96.980804151525.6356W-100000>