Linux – Is the OCZ SSD aligned correctly

advanced-formatalignmentfdisklinuxssd

I have an OCZ Agility 2 SSD with 40 GB of space. I use it as a system drive in Debian Linux ("Squeeze") and in my opinion it's really fast. I've read a lot on aligning partitions and file systems, and I'm not sure if I succeeded in aligning the partitions correctly. Maybe the SSD could be even faster?

I use ext4 and here is the output of fdisk -cul:

Disk /dev/sda: 40.0 GB, 40018599936 bytes
255 heads, 63 sectors/track, 4865 cylinders, total 78161328 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: [...]

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    73242623    36620288   83  Linux
/dev/sda2        73244670    78159871     2457601    5  Extended
/dev/sda5        73244672    78159871     2457600   82  Linux swap / Solaris

My partitions were created just by the Debian Squeeze setup assistant. So I didn't care about the details of partitioning. But now I think that maybe the installer didn't align it correctly? Actually, 2048 looks good to me (better than odd values like 63 or something like that) but I've no idea.

According to some "SSD Alignment Calculator" I found on the web, the OCZ SSDs have a NAND Erase Block Size of 512kB and their NAND Page Size is 4kB.

2048 is divisible by 4 and 512. So are the partitions aligned correctly?

Best Answer

The default alignment in order to fully ensure compatibility with both 4K sectors and SSD cell boundaries (typically 128 or 256 or 512K) would be 1MByte into the disk.

2048 (sectors) * 512 = 1048576 (or exactly 1MByte)

So to me your disk looks to be properly aligned, both with your flash-erase cell size and the page write size.

Remember that sector counts start at 0, so while it claims to be at sector 2048 the actual sector your partition is starting at is the 2049th sector of the disk, which places it in the first sector after the first two NAND-flash cells and likewise that sector is also the first sector past the 256th 4KByte "page".

Related Question