Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

migrated from stackoverflow.com Jun 23 '11 at 19:09

This question came from our site for professional and enthusiast programmers.

2 Answers

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".

share|improve this answer
    
You say the default alignment would be 1M for fully compatibility, but 512K also fits your criteria. –  Casey Jun 24 '11 at 21:29
    
I read an article that said 2048 is suggested, because that is what Vista/Win7 uses. –  Casey Jun 24 '11 at 23:41
add comment

The current anecdotes suggest to have 512KB alignment (or greater integer value of log2n), therefore you want to make sure all your start sectors are evenly divisible by 1024 sectors (i.e 512Kbytes).

/dev/sda1   *        2048

2048 / 1024 = 2 OK

/dev/sda2        73244670

73244670 / 1024 = 71527.99

So this if off by 2 sectors. However since it is an extended partition, I think this is correct, as long as you start the real disk partition at sector 73244672. 1 sector must be reserved because the logical partition must be written at the start of the extended partition. Just make sure you check when creating the file system.

/dev/sda5        73244672 

73244670 / 1024 = 71528 OK

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.