Bug 142786 - [request] [geom_part] gpart(8) should recognize NAND media and suggest partition alignment
Summary: [request] [geom_part] gpart(8) should recognize NAND media and suggest partit...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 8.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-13 15:10 UTC by Dan Naumov
Modified: 2018-05-20 23:52 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Naumov 2010-01-13 15:10:01 UTC
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.

Fix: 

No known fix, requesting additional functionality be added to gpart.
How-To-Repeat: Attach an SSD disk
Boot FreeBSD
Run gpart
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2010-01-13 23:06:48 UTC
State Changed
From-To: open->suspended

Mark suspended awaiting someone to take up implementing this.
Comment 2 Rebecca Cran freebsd_committer freebsd_triage 2010-03-18 21:49:58 UTC
Apparently this is also an issue on new hard drives with large sector sizes; 
without proper alignment performance suffers. See 
http://lists.freebsd.org/pipermail/freebsd-hackers/2010-March/031154.html for 
a recent discussion of the issues.

-- 
Bruce Cran
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:52:17 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"