How do I align the SSD cache to 4K?

Status
Not open for further replies.

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
Only by building the zpool so it does align properly. My presentation explains the thumbrules.

Edit: oops.. you said SSD cache. Not that I know of. It should be aligned(or not aligned) based on your partitions...
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,996
Under the hood of a SSD they are all 4k blocks. You cannot think of them in the same terms as conventional hard drives. Unfortunately I don't believe you can check the ashift value in a cache but you can in a log and the pool.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
Good question regarding aligning the SSD cache... For all we know the writes to the SSD cache aren't even in 4k blocks, so even if we're aligned it might not matter one bit if the cache is being written in random block sizes.

I tried googling and I can't really find any solid answer as to how(or even if) you can align the cache. It could be that this is considered a non-issue because the designers of ZFS assume you wouldn't be so crazy to use an MLC based drive(which would be the most affected by non-aligned writes). It's too bad there isn't some "book of all things ZFS" that explains all this stuff in its fantastic glory. I'd love to read it cover-to-cover.
 

Daisuke

Contributor
Joined
Jun 23, 2011
Messages
1,041
Under the hood of a SSD they are all 4k blocks. You cannot think of them in the same terms as conventional hard drives. Unfortunately I don't believe you can check the ashift value in a cache but you can in a log and the pool.

Thanks Joe. When I originally built the pool I remeber checking the 4K box but I saw no options for the SSD cache. So I assume there is no way to align it from what cyberjock says, right?
 

paleoN

Wizard
Joined
Apr 22, 2012
Messages
1,402
When I originally built the pool I remeber checking the 4K box but I saw no options for the SSD cache. So I assume there is no way to align it from what cyberjock says, right?
The "problem" isn't so much aligning, though you need alignment, as AFAIK ZFS will write to the cache using the block size, 512b - 128k, of whatever it's caching.

Good question regarding aligning the SSD cache... For all we know the writes to the SSD cache aren't even in 4k blocks, so even if we're aligned it might not matter one bit if the cache is being written in random block sizes.
Not random, but the available block sizes.

It could be that this is considered a non-issue because the designers of ZFS assume you wouldn't be so crazy to use an MLC based drive(which would be the most affected by non-aligned writes).
:confused: MLC based drives are essentially tailor made, read optimized, for L2ARC devices.


You can force all blocks to use a minimum of 4K for the cache device by gnop-ing it first and then adding it to the pool via the gnop. But I believe you would need to do this on every reboot.
 
Status
Not open for further replies.
Top