SSD partition alignment confusion

User discussion and information resource forum for BootIt Bare Metal and BootIt UEFI
rustleg
Posts: 136
Joined: Thu Sep 01, 2011 5:01 pm

SSD partition alignment confusion

Post by rustleg »

Due to the recent post by Jeffrey Lee
http://www.terabyteunlimited.com/ucf/vi ... ?f=2&t=173
I have been looking into SSD partition alignment recommendations. I'm confused.

Various recommendations I have seen are

1. 4KiB alignment
2. You should only need to make sure that the start and end sectors of partitions are multiples of the size of your erase block. The Erase Block Size is largely vendor specific. (my SSD is Intel 320 120GB - not found the erase block size)
3. General consensus is to start your first partition at 1,048,576 bytes, as it is evenly divisible by 512, 4096, 131,072, and 524,288 bytes, covering all sector, filesystem block, and erase block size possibilities.
4. (Linux) -remember that fdisk in Linux uses “heads” and “tracks” to define cylinders. If the cylinder boundary is not aligned with the “page” of an SSD, then the SSD can easily undergo extra work during a read/modify/write cycle. By default, Linux fdisk uses a default geometry of 255 heads, 63 sectors/track, and, still currently, 512-byte sectors. This results in 16,065, 512-byte sectors per cylinder (2,008.125, 4KB pages). This is definitely not aligned on 4KB pages. So we need to adjust the geometry to align the cylinder boundaries on 4KB pages so that any partitions are aligned on page boundaries.

It is claimed that Windows 7 automatically starts a partition at the front of a drive at the 2MB point (2048k) - if you set up the partition with BIBM initially this presumably is not applicable (unless Windows leaves the first part vacant).

I believe the recommendations are made to optimise writing pages and erasing blocks (which are multiples of pages). Personally I don't see the logic regarding erasing as the OS doesn't delete files based on blocks or pages. So even if you aligned on a block the OS would still fragment the content of blocks. Regarding writing pages I understand a page is usually 4KiB so ideally one would want the OS to write in aligned 4KiB chunks.

As Windows' NTFS partitions use 4096 byte clusters maybe alignment to 4KiB is desirable.

I also use Linux and checking my Mint 11 root partition the block size is 4096.

So my take at the moment is I'd like to align at 4KiB. However BIBM seems only to be able to align at 2KiB. Looking at TB's Knowledgbase article "Understanding 4K Sector Drives and WD Advanced Formatting" it says:
You can use BootIt Bare Metal to align your new or existing partitions by enabling its global Align at 2048 option. So am I to assume this option is targeted at hard disks not SSDs?

In the IFW manual there's an option to align based on 2048 sectors (not bytes) "Use 2048 Sector Alignment – Use this option to instruct Image for Linux to align restored partitions based on 2048 sectors." However this doesn't seem to be possible with BIBM options when creating a partition in the first place.

In TB support's reply to the above mentioned post it mentions using the 2KiB alignment in BIBM. Is this sufficient?

Any help or information on the above would be very welcome.
TeraByte Support
Posts: 3596
Joined: Thu May 05, 2011 10:37 pm

Re: SSD partition alignment confusion

Post by TeraByte Support »

Align 2KiB is sector alignment (1MiB for standard 512 byte sectors).

"rustleg" wrote in message news:480@public.bootitbm...

Due to the recent post by Jeffrey Lee
viewtopic.php?f=2&t=173
I have been looking into SSD partition alignment recommendations. I'm
confused.

Various recommendations I have seen are

1. 4KiB alignment
2. You should only need to make sure that the start and end sectors of
partitions are multiples of the size of your erase block. The Erase Block
Size is largely vendor specific. (my SSD is Intel 320 120GB - not found the
erase block size)
3. General consensus is to start your first partition at 1,048,576 bytes, as
it is evenly divisible by 512, 4096, 131,072, and 524,288 bytes, covering
all sector, filesystem block, and erase block size possibilities.
4. (Linux) -remember that fdisk in Linux uses “heads” and “tracks” to define
cylinders. If the cylinder boundary is not aligned with the “page” of an
SSD, then the SSD can easily undergo extra work during a read/modify/write
cycle. By default, Linux fdisk uses a default geometry of 255 heads, 63
sectors/track, and, still currently, 512-byte sectors. This results in
16,065, 512-byte sectors per cylinder (2,008.125, 4KB pages). This is
definitely not aligned on 4KB pages. So we need to adjust the geometry to
align the cylinder boundaries on 4KB pages so that any partitions are
aligned on page boundaries.

It is claimed that Windows 7 automatically starts a partition at the front
of a drive at the 2MB point (2048k) - if you set up the partition with BIBM
initially this presumably is not applicable (unless Windows leaves the first
part vacant).

I believe the recommendations are made to optimise writing pages and
erasing blocks (which are multiples of pages). Personally I don't see the
logic regarding erasing as the OS doesn't delete files based on blocks or
pages. So even if you aligned on a block the OS would still fragment the
content of blocks. Regarding writing pages I understand a page is usually
4KiB so ideally one would want the OS to write in aligned 4KiB chunks.

As Windows' NTFS partitions use 4096 byte clusters maybe alignment to 4KiB
is desirable.

I also use Linux and checking my Mint 11 root partition the block size is
4096.

So my take at the moment is I'd like to align at 4KiB. However BIBM seems
only to be able to align at 2KiB. Looking at TB's Knowledgbase article
"Understanding 4K Sector Drives and WD Advanced Formatting" it
says:
You can use BootIt Bare Metal to align your new or existing partitions by
enabling its global Align at 2048 option. So am I to assume this option is
targeted at hard disks not SSDs?

In the IFW manual there's an option to align based on 2048
[b:n2yvmx3k]sectors[/b:n2yvmx3k] (not bytes) "Use 2048 Sector
Alignment – Use this option to instruct Image for Linux to align restored
partitions based on 2048 sectors." However this doesn't seem to be
possible with BIBM options when creating a partition in the first place.

In TB support's reply to the above mentioned post it mentions using the 2KiB
alignment in BIBM. Is this sufficient?

Any help or information on the above would be very welcome.

rustleg
Posts: 136
Joined: Thu Sep 01, 2011 5:01 pm

Re: SSD partition alignment confusion

Post by rustleg »

Align 2KiB is sector alignment (1MiB for standard 512 byte sectors).
OK that's my confusion then. I took 2KiB to be 2048 bytes. Doesn't the B stand for bytes?
Might be a good idea to expand the explanation in the manual.

Supplementary clarification - if I choose to create the partition with 0 free space at the end (some of my partitions are placed at the other end of the drive) will they still start at a 1MiB boundary (thus leaving a bit over at the end)?
TeraByte Support
Posts: 3596
Joined: Thu May 05, 2011 10:37 pm

Re: SSD partition alignment confusion

Post by TeraByte Support »

yes, but in any case, 1M=2048 so it's always aligned at 1M.


perhaps it should be Align 2048 .. like it was in something else (BING?).

"rustleg" wrote in message news:482@public.bootitbm...

[quote:jthtqyus]Align 2KiB is sector alignment (1MiB for standard 512 byte
sectors).[/quote:jthtqyus]
OK that's my confusion then. I took 2KiB to be 2048 bytes. Doesn't the B
stand for bytes?
Might be a good idea to expand the explanation in the manual.

Supplementary clarification - if I choose to create the partition with 0
free space at the end (some of my partitions are placed at the other end of
the drive) will they still start at a 1MiB boundary (thus leaving a bit over
at the end)?

Brian K
Posts: 2213
Joined: Fri Aug 12, 2011 1:11 am
Location: NSW, Australia

Re: SSD partition alignment confusion

Post by Brian K »

Align at 2KiB. We know it means 1 MiB (2048 sectors) but....
What is the origin of the term "2KiB"?
TeraByte Support
Posts: 3596
Joined: Thu May 05, 2011 10:37 pm

Re: SSD partition alignment confusion

Post by TeraByte Support »

2KiB = 2048

"Brian K" wrote in message news:488@public.bootitbm...

Align at 2KiB. We know it means 1 MiB (2048 sectors) but....
What is the origin of the term "2KiB"?
Brian K
Posts: 2213
Joined: Fri Aug 12, 2011 1:11 am
Location: NSW, Australia

Re: SSD partition alignment confusion

Post by Brian K »

I obviously don't understand the convention. But to many people it looks like 2 kibibytes.
Patosan
Posts: 44
Joined: Sat Dec 31, 2011 1:23 am

Re: SSD partition alignment confusion

Post by Patosan »

I'd like to add a question to this thread.

Prior to changing my ssd I made an image of the XP version there and would like to restore it in my new ssd, which seems to be set up correctly for ssd. I feel that I hadn't done a good job on my previous ssd, XP looked to not be aligned well. My question is about whether alignment is taken as being that of the partition on the disk or Xp within the partition. I feel it's to do with the former and if so I should be able to restore it now without fear. If it's the latter then the image is not of much use. Or is there something I could do in the restore process ?
TeraByte Support(PP)
Posts: 1643
Joined: Fri Aug 12, 2011 12:51 am

Re: SSD partition alignment confusion

Post by TeraByte Support(PP) »

Make sure the Align at 2KiB option is enabled when restoring so the restored partition's alignment is correct. This option is in the Global Geometry Settings section.
Bob Coleman
Posts: 785
Joined: Fri Aug 12, 2011 5:58 pm

Re: SSD partition alignment confusion

Post by Bob Coleman »

Brian K wrote:I obviously don't understand the convention. But to many people it looks like 2 kibibytes.
I wish I could have sent this to you directly because I'm not sure I know what I'm talking about, but I couldn't figure out how to do that.

I think I read something somewhere sometime that makes me think Terabyte Support uses a convention in which KB means multiples of 1000 decimal and KiB means multiples of 1024 decimal.
Post Reply