Subject: Re: NFS root problems [Was: Re: Kernel cross build problems]
To: Ben Harris <bjh21@netbsd.org>
From: Ian Fry <Ian.Fry@sophos.com>
List: port-arm26
Date: 11/13/2001 08:45:26
On Mon, Nov 12, 2001 at 10:32:13PM +0000, Ben Harris wrote:
> On Mon, 12 Nov 2001, Ian Fry wrote:
> > Over the weekend, I did a bit more playing around, and instead of dd-ing
> > from the disk, I used /dev/zero. The same thing happened - I ended up
> > with a file that was 24k too small when trying to create a 512k file.
> > I'll do some more tests tonight with different sized files to see if
> > there's any pattern to how much the files get truncated by.
> I had a quick play, and what I seem to have got is that files get truncated
> down to the next size that fits (n * 32k) + 8k, for integer n, so you get
> 8k, 40k, 72k etc.  I don't know why, yet.

Yes, I did some tests last night using the following script (and some slight
variations with different block sizes to make sure that that wasn't a
factor):

#! /bin/sh
dd if=/dev/zero of=test1k.dat bs=1k count=1
dd if=/dev/zero of=test2k.dat bs=1k count=2
dd if=/dev/zero of=test4k.dat bs=1k count=4
dd if=/dev/zero of=test8k.dat bs=1k count=8
dd if=/dev/zero of=test16k.dat bs=1k count=16
dd if=/dev/zero of=test32k.dat bs=1k count=32
dd if=/dev/zero of=test64k.dat bs=1k count=64
dd if=/dev/zero of=test128k.dat bs=1k count=128
dd if=/dev/zero of=test256k.dat bs=1k count=256
dd if=/dev/zero of=test512k.dat bs=1k count=512
dd if=/dev/zero of=test1m.dat bs=1k count=1024
dd if=/dev/zero of=test2m.dat bs=1k count=2048

This produced the following results:

       0 Nov 12 20:02 test1k.dat
       0 Nov 12 20:02 test2k.dat
       0 Nov 12 20:02 test4k.dat
    8192 Nov 12 20:02 test8k.dat
    8192 Nov 12 20:02 test16k.dat
    8192 Nov 12 20:02 test32k.dat
   40960 Nov 12 20:02 test64k.dat
  106496 Nov 12 20:02 test128k.dat
  237568 Nov 12 20:02 test256k.dat
  499712 Nov 12 20:02 test512k.dat
 1024000 Nov 12 20:02 test1m.dat
 2072576 Nov 12 20:03 test2m.dat

So, of these, only an 8k file produces an 8k file! Anything less than 8k
produces a zero size file, and anything above 32k (including 32k) produces a
file 24k too short. Hmmm...

Ian.