4k alignment

Currently i’m a little bit confused. I’m trying to take care about the correct 4k alignment to get best performance for new HDDs with size > 2TiB. I’m using the following command till now, but i know it is not the optimal setting, but how to tell parted to auto-align the partition?

parted -s — ${device} mklabel gpt mkpart primary 0 -1

Using

parted -s -a optimal — ${device} mklabel gpt mkpart primary 0s -1s

does not fix the problem. Everytime the partition layout looks like

# fdisk -lu /dev/sdd
WARNING: GPT (GUID Partition Table) detected on ‘/dev/sdd’! The util fdisk doesn’t support GPT. Use GNU Parted.
Disk /dev/sdd: 106 MB, 106954752 bytes
255 heads, 63 sectors/track, 13 cylinders, total 208896 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: 0×00000000
Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1      208895      104447+  ee  GPT
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(0, 0, 1) logical=(0, 0, 2)
Partition 1 has different physical/logical endings:
phys=(1023, 254, 63) logical=(13, 0, 51)

which is not optimal. Any tipps?

17 Comments

  1. Matt

    I’ve been running a bunch of WD EARS drives and it has always been a pain. The drive doesn’t report the actual physical sector size.

    I simply use the following command in parted to manually align it: mkpart primary 64 -1

    I’m fairly certain you can also align it on mkpart primary 40 -1 (and a few others)

    You might just keep a small list of drive names that have 4k sectors and apply the right scheme. It is ugly and a hack–but it is probably less pain. Eventually the drives will stop lying to us.

    • volker

      I simply use the following command in parted to manually align it: mkpart primary 64 -1

      If you do so, what is shown if you execute ‘parted -l /dev/sdX’ ? Is the entered start point used or has it been changed by parted. If i use 2048s 100% the list command displayes me something like 17.9k for the start point of the partition. But i have to say that ‘parted /dev/sdX align-check opt 1′ tells me the partition is aligned correctly.

  2. rjwaldren

    I haven’t looked at it in a while… I sold off my WD EARS drives because of the hassle and don’t regret it.

    gdisk – \GPT fdisk\ per the authors site should do the right thing on 4k drives, but it’s only in sid and even the sid version is from before support was added and the debian package appears unmaintained.

    So far in my search, aside from the latest gdisk the only other tool that claims it should always do the right thing is gparted. Any other tools (parted, fdisk, etc) are vague in thier changlogs or require manual intervention. Sadly if the drives didn’t lie the tools could do the right thing without hacks.

    • rjwaldren

      I made a mistake – The version of gdisk in Sid is current, the date on the authors site is wrong. I’m assuming you want to use tools available in Squeeze though, rather than workarounds or self hosting.

      • volker

        > I’m assuming you want to use tools available in Squeeze though, rather than workarounds or self hosting.
        That’s right.

  3. btechnet

    Volker, there is a patch for the 4k problem with parted. Ubuntu 10.04 included the patch to fix the 4k problem. While some people still complain about it not working, it seems as it might not be a solution to the problem.

    What about using fdisk instead for 4k alignment?

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *