[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: GPT and SSDs



On Mon, 19 May 2014, Gary Dale wrote:
> This led me into partitioning. I thought that GPT pretty much gave
> you proper partition alignment, but now I think I was mistaken on

Unfortunately, it doesn't :-(

> that point. gdisk shows my first partition starting at 34, with the
> fdisk info showing 255 heads, 63 sectors/track. That doesn't come
> close to 4k alignment.

You're using a SSD.  You need 4KiB aligment, but you really want erase-block
alignment.  When in doubt, use the 1MiB default alignment used by Debian
(and most other Linux distros) and also by MS Windows.

Since Debian Wheezy, the Debian installer for x86 (i386 and amd64) should
have done this properly as long as you let it wipe any preexisting partition
tables (that might be incorrectly aligned).

Unfortunately, the Debian installer for other arches (such as powerpc) may
be buggy and get it wrong (in fact, powerpc's installer fails to align GPT
partitions).

BTW: you also need to align the data area of any LVM PVs (which really can
only be done at PV creation time), and create the filesystem with the proper
alignment for their internal structures.  The debian installer for i386 and
amd64 is known to do this correctly, but YMMV on any of the other arches.

> Before I haul out sysrescuecd and move my partitions around, I
> thought I'd ask for suggestions. Should I move the filesystem to
> something that is a multiple of 8, do something else, or look
> elsewhere for a solution to my problem?

Align everything to 1MiB (or, if you happen to know it, the erase block size
of your SSD, which will be a submultiple of 1MiB).

You can ignore cylinder alignment: the BIOS would boot using LBA information
anyway and ignore the cylinder/sector/head crap, EFI will grok the GPT
natively, and you should not be letting any operating systems old enought to
not operate in LBA mode anywere close to a raw device.

Don't use half-assed tools to mess with the partitions.  Proper tools known
to get aligment right by default on Debian stable/testing are: gdisk,
cfdisk, mdadm, lvm, mke2fs (mkfs.ext4), mkfs.xfs (for XFS).  "parted" gets
it right only if you give it fuzzy units (such as "0%" instead of "0" for
the start of a partition).  fdisk also aligns correctly when it is not
trying to be compatible with old DOS.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh


Reply to: