# What filesystem block size should I choose?

## jose.maria

I am going to install Gentoo on a SSD which has a block size (page size) of 8k. The initial idea is to make an ext4 filesystem with a block size of 8192 bytes, but this is not supported yet. So far a maximum block size of 4k is possible.

My doubt is, should I choose another filesystem with 8k block size support or is it 4k good enough for my SSD?

Being 8k a multiple of 4k, perhaps choosing a 4k block size is already optimum, perhaps the 8k writes on the disk would just take two blocks and the difference between having a block size of 8k and one of 4k is not noticeable. I am a little bit confused.

Can anyone throw some light on this issue?

----------

## eccerr0r

Ideally when matching block sizes, you do this to not have to do make the disk write out half and then rewrite the other half when having to share a block if using 4K blocks.  But in reality it will deal with it properly, you don't really have to worry about it, and the smaller block sizes will save you disk space when dealing with stuff like /usr/portage...

As long as you don't partition with a non-integer multiple 8k (to be safe) so that whenever writing 4K blocks you straddle two 8K blocks.  That will cause a serious performance drop and unnecessary flash wear.

----------

## eccerr0r

duplicate post

----------

## aCOSwt

My opinion is that your questioning about which filesystem to use is pertinent.

But not necessarily based on the most important criteria.

With SSDs it appears interesting to use filesystems supporting TRIM.

EXT4 is said supporting it but when reading man mount, I see that the discard option is off by default until sufficient testing is made.

So, you could find sensible to search for another type of filesystem, with a fully validated support of TRIM which could... incidentally enable 8k blocks.

BTW, if you decide to keep on EXT4, do not forget to mount it noatime, nodiratime, discard.

----------

## jose.maria

I was aware of TRIM and the mount options for ext4, which will be present in the fstab file once I install Gentoo. What puzzles me now is the following. An aligned partition is recommended for a SSD. Now, I have read articles which tell that the alignment should be done considering the erase block size of the SSD, while others tell it should be the block size (page) that determines the alignment. Both seem logical to me, but are they not mutually exclusive? Or can both conditions be fulfilled together?

I am reading about the other option people consider for having a TRIM enabled filesystem, which is Btrfs. It seems it is experimental, but maybe it is worth trying. What do you think?

----------

## eccerr0r

Erase sizes are huge.  Just make sure that your blocks do not tend to straddle erase sizes; with block sizes smaller than erase sizes this becomes a non-issue.

Since erase size is a multiple of page (and tending block) size, it's not hard to meet both.  Just a matter of how much space you want to waste.  Since erase blocks of SSDs are huge and the first 512 bytes on the disk is wasted being a boot sector, typically the first 1MB is skipped to allow for subsequent filesystems to be aligned to page, erase page, 4K-block (for newer hard disks), and the whole 9 yards...

Currently I'm just using ext4 for both of my TRIM capable SSDs, and ext3 for my non-TRIM capable SSD.

----------

