bin/142786: gpart should recognize NAND media and suggest partition
dan.naumov at gmail.com
Wed Jan 13 15:10:02 UTC 2010
>Synopsis: gpart should recognize NAND media and suggest partition alignment
>Arrival-Date: Wed Jan 13 15:10:01 UTC 2010
>Originator: Dan Naumov
>Release: FreeBSD 8.0-RELEASE
Due to the way most, if not all SSDs work, it is highly recommended the disk partitions be properly aligned to the NAND Erase Block Size. If this is not followed, it causes degraded random write performance, because instead of writing to 1 physical block, writes often have to be done to 2 blocks instead. As a additional consequence, this also has the effect of increasing the amount of writes to the SSD, increasing the wear and decreasing the usable lifetime of the SSD, because NAND has a finite limited amount of write cycles it can withstand. In additional to SSD disks, this same problem applies to more traditional Flash media, like USB memory sticks and CF cards.
Windows 7 and Windows Server 2008 R2 recognize this issue and when the installation process detects that Windows is being installed on an SSD disk, it automatically creates the first partition at a 1MB offset. Why 1MB? Different SSD manufacturers use different NAND Erase Block Sizes. Some use 512kb, some use 1Mb, making 1Mb the offset for the first partition work with both and is the best choice for having the compatibility with the biggest amount of SSDs on the market.
This is all relatively simple when only 1 single partition is used on the entire disk, because you only have to worry about the offset for that partition alone. However, the problem is magnified when it is intended to have multiple partitions on an SSD as ALL of them must be properly aligned to fit within the blocks "just right".
I believe that when starting to create a new partition table using gpart, gpart should ask the user whether the disk being accessed is a traditional mechanical disk or an SSD/CF card/USB stick/other NAND media and if the user picks the latter option, gpart should suggest a "flash media mode" (or other suitable name). Picking this, gpart would still function almost as it normally would, except it would automatically create a proper offset for the first partition as well as round up user's size choices for multiple partitions in order for them to be aligned properly, creating small gaps between partitions if/when necessary.
Right now, manually creating properly aligned partitions for optimal use with NAND-based media is a truly painful process.
Attach an SSD disk
No known fix, requesting additional functionality be added to gpart.
More information about the freebsd-bugs