[Ocfs2-users] Different size with du and ls

Joel Becker Joel.Becker at oracle.com
Thu Jul 10 16:58:15 PDT 2008


On Fri, Jul 11, 2008 at 12:06:48AM +0200, Markus Meyer wrote:
> Jep, 4 TB it is ;)
> 64k!? I had to act fast so I didn't have the time to check all mkfs 
> options. As I read about the "-T mail" option I thought it would choose 
> sensible values for creating the FS. All the files are around 12-15 kB 
> in size and the blocksize was 4 kB as in the XFS filesystem we use.

	If all files are 12-15k, perhaps you want a clustersize of 8k or
16k.  If your files are always written in one go, though, 4K will do you
just fine.

> Blocksize I understand but what means cluster size in this context (I 
> read the man page but couldn't wrap my head around it).

	ocfs2's unit of allocation is a 'cluster'.  The smallest file is
one cluster in size.  An ocfs2 filesystem can have at most UINT32_MAX
clusters (2^32 - 1, or 4294967295).  Thus, a filesystem with 4K clusters
can be at most 16TB (which you fit within).  Larger cluster sizes allow
larger filesystems (up to 4PB with 1M clusters).
	The other benefit of larger cluster sizes is reduced
fragmentation.  A 16K file requires 4 4K clusters but only 1 16K
cluster.  If the filesystem is fragmented, those 4 clusters can be in
different places on the disk, increasing seek times and reducing
throughput.
	Thus, there are two reasons to choose a larger cluster size.
Your disk is so bit that it is needed, or you have larger files that
benefit from improved contiguousness.  The downside, as you know, is
wasted space from small files.
	mkfs.ocfs2 has to try and guess what the filesystem is going to
be used for.  Larger filesystems are often used for large files like
database data, so larger cluster sizes are chosen.  It's not a perfect
science, which is why we provide the -T option as well as explicit
sizes.
	Block sizes are units of metadata.  A file inode.  An allocation
tree element.  These are sub-cluster entities.  You can have blocks of
512, 1K, 2K, or 4K bytes.  The larger the blocksize, the more metadata
can be held in it - this is especially useful for files with lots of
fragmented data extents, among other things.  We really recommend 4K
blocks for all users - there isn't much to be gained from going smaller,
and there is much to be lost.

> Still it seems that reformatting is my only choice since I don't have 
> enough space with the current setup. *argh*

	How do you not have enough space?  You have a *lot* of files?

Joel

-- 

"Here's something to think about:  How come you never see a headline
 like ``Psychic Wins Lottery''?"
	- Jay Leno

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-users mailing list