Optimizing Performance of SSDs and Advanced Format Drives: Difference between revisions

From Lustre Wiki
Jump to navigation Jump to search
(Created page with "The following information is taken from a FAQ entry on the ZFS on Linux project web site, reference: https://github.com/zfsonlinux/zfs/wiki/faq. Advanced Format (AF) is a dis...")
 
mNo edit summary
Line 5: Line 5:
The default behavior of ZFS is to automatically detect the sector size of the drive. However, when attempting to detect the sector size of an AF drive, ZFS will not be able to detect the native sector size, and will instead trust the drive when it reports the emulated size. This can result in poorly aligned disk access that degrades performance of the pool.
The default behavior of ZFS is to automatically detect the sector size of the drive. However, when attempting to detect the sector size of an AF drive, ZFS will not be able to detect the native sector size, and will instead trust the drive when it reports the emulated size. This can result in poorly aligned disk access that degrades performance of the pool.


Therefore, the ability to set the <code>ashift</code> property has been added to the <code>zpool</code> command. This allows users to explicitly assign the sector size when devices are first added to a pool (typically at pool creation time or when adding a <code<vdev</code> to the pool). The <code>ashift</code> values range from 9 to 16, with the default value 0 meaning that ZFS should auto-detect the sector size.
Therefore, the ability to set the <code>ashift</code> property has been added to the <code>zpool</code> command. This allows users to explicitly assign the sector size when devices are first added to a pool (typically at pool creation time or when adding a <code>vdev</code> to the pool). The <code>ashift</code> values range from 9 to 16, with the default value 0 meaning that ZFS should auto-detect the sector size.


This issue is rare on hard disk drives, and so it might not be necessary to alter the <code>ashift</code> value. However, there are reports that SSDs can benefit from setting the <code>ashift</code> property explicitly to match the 4096 byte sector size.
This issue is rare on hard disk drives, and so it might not be necessary to alter the <code>ashift</code> value. However, there are reports that SSDs can benefit from setting the <code>ashift</code> property explicitly to match the 4096 byte sector size.

Revision as of 20:25, 14 August 2017

The following information is taken from a FAQ entry on the ZFS on Linux project web site, reference: https://github.com/zfsonlinux/zfs/wiki/faq.

Advanced Format (AF) is a disk format that natively uses a sector size of 4,096 bytes instead of 512 bytes. To maintain compatibility with legacy systems, AF disks emulate a sector size of 512 bytes.

The default behavior of ZFS is to automatically detect the sector size of the drive. However, when attempting to detect the sector size of an AF drive, ZFS will not be able to detect the native sector size, and will instead trust the drive when it reports the emulated size. This can result in poorly aligned disk access that degrades performance of the pool.

Therefore, the ability to set the ashift property has been added to the zpool command. This allows users to explicitly assign the sector size when devices are first added to a pool (typically at pool creation time or when adding a vdev to the pool). The ashift values range from 9 to 16, with the default value 0 meaning that ZFS should auto-detect the sector size.

This issue is rare on hard disk drives, and so it might not be necessary to alter the ashift value. However, there are reports that SSDs can benefit from setting the ashift property explicitly to match the 4096 byte sector size.

The value of ashift is actually a bit shift value, so the ashift value for 512 bytes is 9 (29 = 512) while the ashift value for 4,096 bytes is 12 (212 = 4,096). To force the pool to use 4,096 byte sectors at pool creation time:

$ sudo zpool create -o ashift=12 tank mirror sda sdb

To force the pool to use 4,096 byte sectors when adding a vdev to a pool:

$ sudo zpool add -o ashift=12 tank mirror sdc sdd