On Tue, Feb 3, 2009 at 20:55, SQA <sqa...@gmail.com> wrote:
> I set up a ZFS system on a Linux x86 box.
>
> [b]> zpool history
>
> History for 'raidpool':
> 2009-01-15.17:12:48 zpool create -f raidpool raidz1 c4t1d0 c4t2d0 c4t3d0 
> c4t4d0 c4t5d0
> 2009-01-15.17:15:54 zfs create -o mountpoint=/vol01 -o sharenfs=on -o 
> canmount=on raidpool/vol01[/b]
>
> I did not make the export (vol01) into a volume. I know you can set default 
> blocksizes when you create volumes but you cannot make them exportable NFS 
> exports.  Thus, I did not make the NFS exports into volumes and I did not 
> specify a blocksize on the NFS exports.
>
> I am assuming that vol01 is using variable blocksizes because I did not 
> explicitly specify a blocksize. Thus, my assumption is that ZFS would use a 
> blocksize that is the the smallest power of 2 and the smallest blocksize is 
> 512 bytes while the biggest would be 128k
>
> I use the stat command to check the filesize, the blocksize, and the # of 
> blocks.
>
> I created a file that is exactly 512 bytes in size on /vol01
>
> I do the following stat command:
> [b]stat --printf "%n %b %B %s %o\n" * [/b]
>
> The %b is the number of blocks used, %B is the blocksize.
>
> The number of blocks changes after a few minutes after the file is created:
>
> # stat --printf "%n %b %B %s %o\n" *
> file.512 [b]1[/b] 512 512 4096
> # stat --printf "%n %b %B %s %o\n" *
> file.512 [b]1[/b] 512 512 4096
> # stat --printf "%n %b %B %s %o\n" *
> file.512 [b]1[/b] 512 512 4096
>
> Q1) Why does the # of blocks change after a few minutes? And why are we using 
> 3 blocks when the file is only 512 bytes in size (in other words, only 1 
> block is needed)???  This makes it seem that the minimum blocksize isn't 512 
> bytes but 1536 bytes.

You probably have a cut'n'paste error as all block numbers are 1 in
your example.

My guess is that the number of blocks are updated every 5 seconds.

>
> Q2) Is there a way to force ZFS to use 512 blocksizes?  That means that if a 
> file is 512 bytes in size or smaller, it should only use 512 bytes -- the 
> number of blocks it uses should be 1.

It is, or at least is is on my solaris system. But it has to store
metadata in one block. Try creating a 600 byte file and it should use
one more 512 byte block.
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to