Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Oct 2012 10:58:32 -0700
From:      freebsd@johnea.net
To:        freebsd-questions@freebsd.org
Subject:   Re: 9.1 and gmirror with GPT?
Message-ID:  <509166E1.1010105@johnea.net>
In-Reply-To: <20121029105905.GA358@icarus.home.lan>
References:  <20121029105905.GA358@icarus.home.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2012-10-29 03:58, Jeremy Chadwick wrote:

> If you're truly using 4096-byte sectors disks -- specifically MECHANICAL
> hard disks (MHDDs) -- use of 4KByte alignment is fine.
> 
> But if you ever plan on using an SSD the future, you need to align
> things to 1MBytes or 2MBytes.

> 
> This is why Windows Vista and Windows 7 aligns its partitions to 1MByte
> boundaries.
> 
> ...and quite honestly FreeBSD should too.  I am aware 9.1-RELEASE
> supposedly addresses this -- however I have not determined if the
> alignment size chosen by the committer was 4096 or 1MB/2MB.  I have a
> gut feeling it's the former, and that's bad.
> 
> With 1MByte or 2MByte alignment, performance on 512-byte MHDDs would be
> fine, performance on 4096-byte MHDDs would be fine, and performance on
> SSDs would be fine.

> 
> Next: in case it's not made clear to readers from Warren's statements:
> the magical "8" divisor he's using comes from 4096/512 ("how many 512
> bytes are there in a 4096-byte sector").  Thus, for 1MByte alignment the
> value would be 1048576/512 or 2048.  For 2MByte alignment the value
> would be 2097152/512 or 4096.
> 

Thank You Jeremy!

In an effort to bring concluding info from the original thread, on some MRB partitioned drives (spinning media in this case) gpart seems unable to align the containing "-t freebsd" slice to 4K boundaries. However subsequent creation of "-t freebsd-ufs" and "-t freebsd-swap" partitions within the slice align correctly.

To make this alignment on 1M boundaries instead of 4K boundaries the "-a 1M" should be used instead of "-a 4K".

Example gpart commands for MBR partition table aligned to 1M sector size for SSD:

gpart create -s MBR mirror/gm0

gpart add -t freebsd -a 1M mirror/gm0
# ignore possible warning "mirror/gm0s1 added, but partition is not aligned"

# create the bsdlabel partitions in slice 1 (s1)
gpart create -s BSD mirror/gm0s1
gpart add -t freebsd-swap -a 1M -s 8g mirror/gm0s1
gpart add -t freebsd-ufs -a 1M mirror/gm0s1

# put bootcode on the MBR and mark the first slice active
gpart bootcode -b /boot/mbr mirror/gm0
gpart set -a active -i 1 mirror/gm0

# put bootcode on the bsdlabel
gpart bootcode -b /boot/boot mirror/gm0s1




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?509166E1.1010105>