about zfs and ashift and changing ashift on existing zpool

Ravi Pokala rpokala at freebsd.org
Tue Apr 9 17:53:24 UTC 2019


-----Original Message-----
Date: Mon, 8 Apr 2019 20:00:09 -0400
From: "Kevin P. Neal" <kpn at neutralgood.org>
To: Peter Jeremy <peter at rulingia.com>
Cc: tech-lists <tech-lists at zyxst.net>, freebsd-fs at freebsd.org,
	freebsd-stable at freebsd.org
Subject: Re:  about zfs and ashift and changing ashift on existing
	zpool
Message-ID: <20190409000009.GA65388 at neutralgood.org>
Content-Type: text/plain; charset=us-ascii

...

> Be careful with that. I've got a new pool I made with 4Kn drives that ZFS
> failed to detect were 4Kn drives. The resulting ashift was 9, but I did
> catch it early enough to avoid too much pain. Still, it shouldn't have
> happened. I've since set the sysctl so it doesn't accidentally happen in
> the future.
...
> Logical block size:   512 bytes
> Physical block size:  4096 bytes

That is *NOT* an AF-4Kn drive, it is an AF-512e drive.

To refresh everyone's memory:

XXXn: "native" - logical block size == physical block size
XXXe: "emulated" - logical block size < physical block size

512n: logical block size = 512B; physical block size = 512B
- Retronym; basically everything commercially available before 2013 was 512n

AF-512e: logical block size = 512B; physical block size > 512B
- Uses a larger physical block size for greater media encoding efficiency
- Retains the same 512B logical block size that software has been expecting for decades
- Firmware performs read/modify/write as needed for changes smaller than the physical block size
- I have only seen AF-512e drives with physical block size 4KB, but apparently there are some with even larger physical blocks out / on the horizon.

AF-4Kn: logical block size = 4KB; physical block size = 4KB
- Uses a 4KB physical block size for greater media encoding efficiency
- Uses a 4KB logical block size, to avoid firmware having to do read/modify/write
- Requires software to be updated to perform logical-block-sized operations

AF-4Ke: logical block size = 4KB; physical block size > 4KB
- I have not seen one of these, but I have heard references to them.

And then there are SSDs, which might report 512B or 4KB as either their logical or physical block sizes, but which actually use much larger NAND program blocks, and even larger NAND erase blocks. But everything about SSD "geometry" is a lie anyway. <sigh>

Also: the FreeBSD GEOM stack is aware of the differences between physical and logical block sizes. For a drive device, GEOM reports the logical block size as the "sector" size, and the physical block size as the "stripe" size. I **think** some (all?) of the in-tree GEOMs will prefer to use "stripe"-sized IOs if possible, falling back to "sector"-sized IOs if necessary.

Thanks,

Ravi (rpokala@)




More information about the freebsd-fs mailing list