Geom_mbr vs. SSD disks (was: proper newts options for SSD disks)

Tim Kientzle tim at kientzle.com
Sun May 20 19:50:13 UTC 2012


On May 19, 2012, at 11:36 AM, rozhuk.im at gmail.com wrote:

> Do not use MBR (or manually do all to align).
> 63 - not 4k aligned.

Right now, the "-a" alignment option for "gpart add" is broken when
used with MBR partitions.   It looks like the gpart command uses
it to correctly align the start/end, but then the actual MBR geom code
does another alignment pass that rounds the start/size to
a multiple of gpt_sectors, which defaults to 63.

This seems problematic.

It's tempting to change sys/geom/part/g_part_mbr.c so that
it skips this additional alignment when the geometry has
defaulted.  Something like this:

Index: sys/geom/part/g_part_mbr.c
===================================================================
--- part/g_part_mbr.c	(revision 235597)
+++ part/g_part_mbr.c	(working copy)
@@ -211,6 +211,7 @@
 
 	start = gpp->gpp_start;
 	size = gpp->gpp_size;
+	if (sectors != 63 || basetable->gpt_heads != 255) {
 	if (size < sectors)
 		return (EINVAL);
 	if (start % sectors) {
@@ -221,6 +222,7 @@
 		size = size - (size % sectors);
 	if (size < sectors)
 		return (EINVAL);
+	}
 
 	if (baseentry->gpe_deleted)
 		bzero(&entry->ent, sizeof(entry->ent));


I'm not really certain I understand all of the implications
of this change, though.

Tim



More information about the freebsd-hackers mailing list