xfs
[Top] [All Lists]

Re: Alignment size?

To: xfs@xxxxxxxxxxx
Subject: Re: Alignment size?
From: Stan Hoeppner <stan@xxxxxxxxxxxxxxxxx>
Date: Fri, 13 Aug 2010 05:27:55 -0500
In-reply-to: <4C64E52E.2060806@xxxxxxxxxxxxxxxx>
References: <4C64715F.8060000@xxxxxxxxxxxxxxxx> <20100812234911.GC10429@dastard> <4C64E52E.2060806@xxxxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6
Michael Tokarev put forth on 8/13/2010 1:24 AM:

> So the question that remains is: why?

4096 is the default block size and has been since at least 2.6.26 when I
started using XFS.  From "man mkfs.xfs":

OPTIONS
-b block_size_options
This  option  specifies the fundamental block size of the filesystem.  The
valid block_size_options are: log=value or size=value and only one can be
supplied.  The block size is specified either as a base two logarithm value
with log=, or in  bytes  with size=.  The default value is 4096 bytes (4 KiB),
the minimum is 512, and the maximum is 65536 (64 KiB).  XFS on Linux currently
only supports pagesize or smaller blocks.

> So why xfs decided the block size is 4K??

See above.  It's the default.  Dave, Eric, Alex and others may be able to
explain why 4096 was chosen as the default.  I'm guessing it has to do with
the best all around performance across a wide variety of storage systems.

> And a related question, -- is there a way to create
> xfs fs with the right sector size?

Yes.

-s sector_size
This option specifies the fundamental sector size of the filesystem.  The
sector_size is specified  either as a value in  bytes  with size=value or as a
base two logarithm value with log=value.  The default sector_size is 512
bytes. The minimum value for sector size is 512; the maximum is 32768 (32
KiB). The sector_size must be a power of 2 size and cannot be made larger than
the filesystem block size.

Note that the default is 512.  This would lead me to believe that whoever
created this 600GB XFS filesystem manually specified "-s 4096" on the command
line when creating it.

> The filesystem
> were ok in years, not only on this machine, and I'm
> quite afraid to replace it with something else (e.g.
> ext4) in a hurry without good prior testing.
> 
> By the way, how one can check the "sector size" of a
> block device nowadays?

cat /sys/block/[device]/queue/hw_sector_size

That will give you the hardware sector size.  As mentioned above, the XFS
sector size can be manually specified during FS creation.  Thus they may not
match, which is likely the case with the 600GB FS you're having the problems 
with.

-- 
Stan

<Prev in Thread] Current Thread [Next in Thread>