Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hover

macrumors newbie
Original poster
Jul 23, 2007
15
0
Hi there,

It is well-established that a wrong partition offset can have bad consequences.

Say, your SSD disk operates with blocks of 4096 bytes and your OS has allocation units of 4096 bytes too (within the partition), BUT the partition itself begins at an offset which is not a multiplier of 4096.

In this case, with each minimal writing operation, the OS would cause actual writing to 2 blocks instead of 1! Which leads to slower operation and extra wear.

The built-in Disk Utility already aligns partitions by 4096 bytes by default.

HOWEVER, some sources also say that for optimal performance, the partitions has to start at multipliers of 512KB, or even larger, depending on the erasing block size of the SSD and the number of its channels.

In order to check where your partitions start, download an opensource utility GPTfdisk http://sourceforge.net/projects/gptfdisk/. Install it, then open a new terminal window and run "sudo gdisk /dev/disk0". Click "p" to list the partitions table.

In my case (created by Disk Utitlity) it is:

Number Start (sector) End (sector) Size Code Name
1 40 409639 200.0 MiB EF00 EFI System Partition
2 409640 430097143 204.9 GiB AF00 one

So the main partition starts at sector 409640. Given that sector size is 512 bytes, the partition is aligned to exactly 4096 bytes.

Now, the question is, is this good enough? Don't we need more, like suggested at http://www.ocztechnologyforum.com/f...you-need-to-know-in-easy-to-understand-format. ? (My disk is an OWC Mercury 240GB, though.)

It would be especially helpful to hear from people with Apple factory-provided SSDs about how their partitions are aligned.
 
Apple supplied toshiba 512GB SSD

Thanks for posting this... was unaware of this.

Number Start (sector) End (sector) Size Code Name
1 40 409639 200.0 MiB EF00 EFI system partition
2 409640 976842879 465.6 GiB AF00 Customer
 
I am also looking to partition my SSD for bootcamp and was hoping someone would have some insight if partitioning an SSD using disk utility slows performance.
 
I remember reading about this before. I think Windows 7 takes care of this automatically, no idea about OSX though. Would like to know though since I have an MBP and an intel SSD ordered...
 
Now with bootcamp:

Number Start (sector) End (sector) Size Code Name
1 40 409639 200.0 MiB EF00 EFI system partition
2 409640 807813159 385.0 GiB AF00 Customer
3 808077312 977104895 80.6 GiB 0700 BOOTCAMP
 
Same here with a Samsung 256 GB
Code:
Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       499856007   238.2 GiB   AF00  MacintoshSSD


So the main partition starts at sector 409640. Given that sector size is 512 bytes, the partition is aligned to exactly 4096 bytes.
Could you explain ? 409640 is not a multiple of 512.
 
Same here with a Samsung 256 GB
Code:
Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       499856007   238.2 GiB   AF00  MacintoshSSD



Could you explain ? 409640 is not a multiple of 512.

409639 - 40 + 1 = 409600

409600 / 512 = 800
or 409600 / 4096 = 100
and 4096 / 512 = 8
which is same as 800 / 100 = 8

So it's divisible;)

Guys, please correct me if my calculation is wrong. I never made it in math:D
 
Bump.

Can anyone update this post? It seems that this is the default alignment provided by OSX but has this been confirmed to align to 512k?
 
NOT aligned to 512kb

To be aligned to the NAND Erase block size, which is 512 KILObyes (for most SSDs), or 524288 bytes, the offset of the OS X partition (209735680 byes, from 409640 sectors * 512 bytes/sector) must be divisible by 524288, which it is not.

Windows 7 always makes an offset that is divisible by 524288. OS X does not seem to. Does it matter? I'm not sure, as I've read that the bigger performance hit comes from not being aligned to the file allocation unit size (4096 bytes), which the default OS X partition offset is.

You can check what I'm saying easily for your own drive with the alignment tool checker here. http://www.techpowerup.com/articles/other/157

A simple soultion would be to, while installing OS X, use the terminal and command line diskutil to make the hidden EFI partition end at sector 409599 and start the OS X partition at 409600, which gives an offset of 209715200 bytes, which is divisible by the NAND erase block size of most SSDs (512kb or less). It's WWWD (what windows would do =) )

If I've said anything wrong, sorry! Fix it, please.

Hope I've been helpful

Note:

I have a dual boot MBP with OSX/windows 7 and a 128GB corsair nova ssd. OS X was installed without me tinkering with anything, as was windows 7. The 7 installer DID align my NTFS partition; Disk utility did NOT align my OS X partiton. Either it doesn't matter, or it's a feature that apple will silently add sooner or later.
 
Last edited:
Same here with a Samsung 256 GB
Code:
Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       499856007   238.2 GiB   AF00  MacintoshSSD



Could you explain ? 409640 is not a multiple of 512.

I feel like I need to clarify this since it created a lot of confusion for me as well.

409640(sectors) * 512(bytes per sector) = 209735680(bytes) / 4096(block allocation unit size in bytes) = 51205 (4k blocks) which is an integer.
 
You can check what I'm saying easily for your own drive with the alignment tool checker here. http://www.techpowerup.com/articles/other/157

A simple soultion would be to, while installing OS X, use the terminal and command line diskutil to make the hidden EFI partition end at sector 409599 and start the OS X partition at 409600, which gives an offset of 209715200 bytes, which is divisible by the NAND erase block size of most SSDs (512kb or less).

Tool tells me that NAND Erase Block Size is misaligned.
Anyone has tried to shrink EFI partition manually to 409599 during install if it worked? Or extend it to 410623 would be one option as well.
OS X partition would then start at sector 410624 which is 210239488 bytes and this can be divided with 524288 bytes (512kB) or with 4096 bytes.

Anyone checked what is the partition alignment in the current version of Lion?
 
Last edited:
Tool tells me that NAND Erase Block Size is misaligned.

You should be fine with the standard 4 kB alignment in Mac OS X. In theory you could get improved performance by partitioning to (at least) the erase block size (normally 512 kB). And partitions should also be aligned to begin at multiples of the erase block size (512 kB). But most recent SSD controllers have enough intelligence to resolve the performance issues internally with misalignment. The controller maintains a lookup table to translate the flash memory physical block address to the logical block address used by the file system. And the flash translation layer is constantly changing the physical address of the data. So I guess it all depends on how smart the SSD controller is and the wear leveling algorithms.
 
Wow guys... OCD much? Hey look, there's a dust particle on your screen! Go crazy.

Agreed.

Given the life expectency of SSDs I'm not really too concerned. I'll be replacing my SSD well before any wear and tear will start showing itself.
 
Call me OCD, but I'm looking to align to the NAND erase block size on my SSD. What is a good tool that can do this on the fly, without messing up the existing data?
 
FYI, I realigned with iPartition and it went smoothly. Now both partitions are fully aligned. :D
 
hey guys..

turns out that Lion does not fully align the drives. I've got SSDs in my 3 machines: work laptop (win7), mediacenter (win7) and my mac (lion).

for my windows machines, i've used this calculator to ensure a fully aligned drive. On the mac, i couldn't get the Partition Offset / NAND Erase Block Size to be aligned.

Using disk utility in Lion to format an empty drive, this is how the drive was partioned:

Code:
Number      Start (sector)      End (sector)       Size            Code  Name
   1              40                  409639       200.0 MiB       EF00  EFI System Partition
   2          409640               234179463       111.5 GiB       AF00  SSD

Using GPTfdisk, i managed to align my disk fully. This is how it looks after the manual repartition:

Code:
Number      Start (sector)      End (sector)       Size            Code  Name
   1            2048                  411647       200.0 MiB       EF00  EFI System Partition
   2          411648               234179463       111.5 GiB       AF00  SSD

You may notice that the EFI partition is exactly the same size as a disk utility partitioned drive. The end sector of my main partition also finishes on the same sector. What this means is that i lose 2MB at the start of the drive, and hence my main partition.

For the EFI partition, i used these settings:

Start Sector: 2048 (1,048,576 bytes)
End Sector: 411647
Code: EF00

For the main partition:

Start Sector: 411648 (210,763,776 bytes)
End Sector: 234179463
Code: AF00

The main partition ends on the exact same sector as a disk utility partitioned drive - which leaves 128MB of free space at the end of the drive (not sure why, but wanted to make it as Mac compliant as possible). After the parition, i put the drive into a windows machine and confirmed that alignment was correct by using the instructions on the alignment calculator site (ie In MSInfo: Components -> Storage -> Disks -> Partition Starting Offset).

Enjoy!
 
Last edited:
Align to NAND page size

Since the Intel 320 SSD has a NAND page size of 8 KiB and the file allocation size in Mac OS X is 4 KiB I decided to realign the partitions and reinstall Lion.

With modern SSD controllers you don't have to worry about the NAND erase block size anymore. But it's very important that all partitions are aligned to the NAND page size!

I decided to use a partition offset of 128 sectors (64 KiB). If you decide to remove the Recovery HD partition you must have at least 128 MiB of free space after the HFS+ partition.

I haven't noticed any increase of performance in Lion but deleting files (empty the trash) is considerably faster now. So I hope everything will perform more smoothly with trim support also enabled.

I used Disk Utility to erase the SSD and then iPartition by Coriolis Systems to realign the partitions. You can also perform a Safe Boot to trim unused blocks when you are done.

Code:
sudo gpt -r show -l disk0

      start       size  index  name
         34         94         
        128     409600      1  EFI System Partition
     409728  311906304      2  MacBook Pro
  312316032     265743
 
Last edited:
I'm still not sure I understand all this, but have just installed a 256Gb Crucial M4 SSD and a clean install of Lion 10.7.2

This is how my partition setup currently looks (I may delete the recovery partition, if its safe to do so BTW) according to gdisk:

Code:
Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       498848615   237.7 GiB   AF00  MacintoshSSD
   3       498848616       500118151   619.9 MiB   AB00  Recovery HD

I have Corolis iPartition 2, so should be able to safely adjust the partitions if need be without having to re-install afresh, but I'm not sure what they *should* be in order to be correctly aligned - can anyone help? Thanks!
 
You're aligned.

I would leave the recovery partition ... just in case you need it. ~600MB is not that much of your total disk.

Okay.

BTW I'm thinking of creating a 60Gb bootcamp partition for Windows 7 Ultimate 64 bit to run a couple of games (e.g. the upcoming Skyrim), is there anything I need to be aware of when creating this to keep my partitions aligned? Thanks
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.