9

I just bought a Lenovo x121e (E-350 version). I was able to successfully install ubuntu 11.04 and everything is running fine (for the system to boot an efi partition seems to be necessary however). The laptop has a Seagate Disk with a physical sector size of 4096 bytes.

After ubuntu is installed Disk Utility reports that my partitions are not properly aligned: screenshot

I have tried both fully automatic install wiping the disk (as shown on the screenshot) and setting the partions manually during install. Both variants show misaligned partitions.

  • Is this this a bug when creating the partitions or is Disk utility giving wrong information?
  • If the alignment is wrong and negatively affecting performance, how can I correct it (either now or with a fresh install)?
1

1 Answer 1

14

I own the TP X121e (AMD E 350), too and ran into the same results that you reported. I found a workaround. It requires a fresh install, although there might be alternatives that don't require this -- well, I haven't tried anything, but at least the following works:

A useful prerequisite was the article http://www.ibm.com/developerworks/linux/library/l-4kb-sector-disks/ and especially the first comment posted by JLockard on 19 November 2010.

My TP X121e has a 320GB Seagate Harddrive that uses a physical sector size of 4096byte and a logical sector size of 512byte and that's where the misalignment comes from (see mentioned article).

I haven't found any way to correctly align partitions to the 4096byte scheme neither with disk utility nor with gparted (there's an "align to MiB" option in gparted but that resulted in misaligned partitions, too).

So I reverted to the command line and used parted (that's the solution the commenter JLockard mentions, see above). And that's what I did:

  1. I booted from my ubuntu-live-usb-flashdrive and used gparted to set up a gpt partition table (that should be possible from command line with parted, too, but I didn't want to dive any deeper in the man pages).

  2. Then I switched to command line and set up the partitions with parted:

    parted -a optimal /dev/sda
    The -a optimal option stands for optimal alignment and that's the thing we need. The command starts an interactive mode where you can just type in the following commands:
    u MiB
    Units to align to should be Mebibytes
    p
    showed me that the harddrive is 305245MiBs large
    mkpart primary 1 20
    Later on, that will be my efi boot partition (an efi partition is required to boot into ubuntu at all, as you correctly pointed out) later on (roughly 20MB, as the automatic ubuntu installation suggested in my earlier installation attempts).
    mkpart primary 20 25020
    That will be a 25000MiB / partition.
    mkpart logical 25020 297245
    will be my 272225MiB /home partition. The rest of available space will be my swap partition (roughly 8GB -> 8GB RAM):
    mkpart logical 297245 100%
    Before proceeding, one can check if alignment is correct with
    align-check optimal N
    where N is the partition number.

  3. Then I started the Ubuntu installer again and chose the "something different"/manual install option. Now I assigned the filesystems and mount points to the previously created partitions (1=efi-boot, 2=ext4 /, 3=ext4 /home, 4=swap). Disc utility shows a 1MB free space before the first partition and a ~375KB free space behind swap. That's due to the optimal alignment.

  4. Installation went on... and: Nicely --or better: optimally-- aligned partitions! I don't know if that really made any difference but at least my system "feels" a little snappier.

Any suggestions for improvement appreciated.

My suggestion for Ubuntu: The disc utility of the installer should get a gui option that sets the optimal alignment for 4096byte-drives. That would be the easiest solution.

1
  • I cant' seem to get it to work u MiB even if my disk is Sector size (logical/physical): 512B/4096B. I wonder why those that made parted coudn't be bothered to add a "Fix it for me"-option when creating new partitions. If they have the code to check the alignment, why can't they suggest a fix for it?
    – mikl
    Jun 27, 2012 at 0:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .