block and fragment sizes with newfs

Erik Trulsson ertr1013 at student.uu.se
Wed Apr 23 12:37:53 PDT 2003


On Wed, Apr 23, 2003 at 11:34:10AM -0500, David Kelly wrote:
> Playing with UFS on CF (Compact Flash) cards where I'm concerned about
> wear and tear, and maximum efficiency.
> 
> It would seem "newfs -b 4096 -f 512" would result in fine grained
> control over each and every 512 byte block on my CF card and eliminate
> writes to multiple blocks when a write to a single block would do.
> 
> The above creates a lot of "superblock backups", leading me to suspect
> what I save in fragment size == block size, I lose in overhead to track
> all these fragments.

I don't think the overhead in used space for keeping track of the
fragments would be significant. You might want to play with the -i
parameter to newfs(8) to control how many inodes you need though.

> 
> The default is "-b 16384 -f 2048", which if I understand correctly means
> the minimum read/write to the filesystem will be 2048 bytes?
> 
> A middle of the ground compromise is "-b 8192 -f 1024".
> 
> What's the deal?

In general you have that:
large block size/fragment size => fast operation, lots of wasted space
small block size/fragment size => slower operation, little wasted space

For a solid state device (like flash memory) I suspect that the speed
loss for smaller blocksizes would be less than it would be for a normal
disk.

I would suggest you try different block sizes and if there is no
noticable speed difference between them you should use the smallest one
(that would be 4096/512 for block/fragment size.) If there is a speed
difference you would have to decide which is more important: speed or
space.



-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se


More information about the freebsd-questions mailing list