Partition Alignment Confusion [duplicate]

I have a new Samsung 840 250GB SSD on the way, and I want to make sure that everything is running optimally after install.

I've spent many frustrating hours on the internet trying to understand how I should align the partitions of the SSD when it arrives (and even how to partition everything; my other drive is a 1TB HDD with files already on it). I'd like to know a foolproof way of setting everything up.

Now, the only place I could find the erase block size of the 840 is here:

http://thessdreview.com/Forums/ssd-beginners-guide-discussion/3630.htm

I simply can't understand why such information isn't made freely accessible by manufacturers! But, anyway, this would suggest the EBS is 1536kb, which seems odd to me.

It is to my understanding that you should now align by MiB (usually set at 1MiB). I assume that the figure above should actually be 1536k B=1.5MiB? This seems to suggest the partition alignment will be somewhat non-standard.

So my question is: How do I align my partitions given this information? Please bear in mind that I have never used linux before; I'm doing my best to get everything set up so that I can begin to learn but am finding this process incredibly opaque and time consuming. If possible, a step by step guide through GParted would be great; at the moment I'm considering an NTFS partition ~20GB for Windows (playing games), an EXT4 ~20GB for ubuntu (for doing everything else) and a shared documents+games partition for everything else in NTFS file format. I'm not going to have any swap partition and use swap files instead.


Assuming the figure of 1536kB (1.5MiB) is correct, you'll need to either use some manual alignment options in your partitioning software (GParted, parted, gdisk, etc.) or align on a multiple of both 1MiB (the default with most modern software) and 1.5MiB. Since 3MiB is the minimum value that satisfies both constraints, that's what you should use.

You're right that 1.5MiB is a bizarre value. It's such an odd value, in fact, that I'm a bit suspicious of it, and I'd err on the size of caution by aligning on a 3MiB boundary, or maybe even 6MiB (just in case the true value is 2MiB).

To do this, you need to understand your partitioning software's options. In GParted, you can't set alignment to an arbitrary value, just to none, cylinder, or MiB. Unfortunately, the user interface, although GUI, is a bit unclear:

GParted's partition-creation dialog box

You'd need to set the space via the "Free Space Preceding" box; but that's the free space between the new partition and the one before it, and where that one ends is unknown -- at least, not from the Create New Partition dialog box. The text-mode parted utility has similar problems.

If your disk should use GPT, I recommend that you use gdisk instead. (If you're booting in BIOS mode and want to use MBR, fdisk gives you more flexibility, but it still can't be set to use arbitrary alignment values, so you'll need to specify you partition start values manually.) You'll have a hard time installing gdisk in the Ubuntu installer, so it's easier to use System Rescue CD or Parted Magic to do the work. You can change the alignment by typing x to enter the experts' menu, using the l (or L) option to set the alignment (which you specify in sectors), and then using 'm' to return to the main menu, from which you can create partitions. It looks something like this:

$ sudo gdisk /dev/sdd
GPT fdisk (gdisk) version 0.8.6

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): x

Expert command (? for help): L
Enter the sector alignment value (1-65536, default = 2048): 6144

Expert command (? for help): m

Command (? for help): n
Partition number (2-128, default 2): 
First sector (34-30297182, default = 6144) or {+-}size{KMGTP}: 
Last sector (6144-30297182, default = 30297182) or {+-}size{KMGTP}: 
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

Command (? for help): p
Disk /dev/sdd: 30297216 sectors, 14.4 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 2E980CFA-8BD4-4D53-BABC-CCEFEFB6B2EF
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 30297182
Partitions will be aligned on 6144-sector boundaries
Total free space is 1566 sectors (783.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1             264            4807   2.2 MiB     EF00  EFI System
   2            6144        30297182   14.4 GiB    8300  Linux filesystem

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdd.
The operation has completed successfully.

See the gdisk documentation, and particularly its walkthrough page, for more information on using this program.

Note that gdisk creates or modifies partitions, but it does not create filesystems. Thus, you'll need to either use mkfs on your partitions or let the installer create filesystems on the partitions that you create.