Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm partitioning a non-SSD hard disk with parted because I want a GPT partition table.

parted /dev/sda mklabel gpt

Now, I'm trying to create partitions correctly aligned so I use the next command to know where begins the first sector:

parted /dev/sda unit s p free

Disk /dev/sda: 488397168s
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End         Size        File system  Name      Flags
        34s    488397134s  488397101s  Free Space

We can see that it starts in the sector 34 (it's by default when this partition table is used).

So, to create the first partition I tried:

parted /dev/sda mkpart primary 63s 127s

to align it in the sector 64 since it's multiple of 8 but it shows:

Warning: The resulting partition is not properly aligned for best performance.

The sector size logical and physical in my hard disk are both of 512 bytes:

cat /sys/block/sda/queue/physical_block_size

cat /sys/block/sda/queue/logical_block_size 

How to create partitions correctly aligned? What I'm doing wrong?

share|improve this question
Are you sure sector numbers start at zero? –  Burton Samograd May 8 '12 at 19:35
I tried too parted /dev/sda mkpart primary 64s 128s (in case it starts in 1) but it returns the same warning. –  Marc May 8 '12 at 20:23
It looks like there's a command to check if a value is aligned: gnu.org/software/parted/manual/html_node/align_002dcheck.html. Maybe try that with various values using a for loop and spit out the values that are ok? –  Burton Samograd May 8 '12 at 20:26
Burton, I didn't know about that command but it cann't be used until to have a partition. –  Marc May 8 '12 at 20:34
Sorry about that, I didn't read the description carefully enough. –  Burton Samograd May 8 '12 at 20:52

2 Answers 2

up vote 21 down vote accepted

In order to align partition with parted you can use --align option. Valid alignment types are:

  • none - Use the minimum alignment allowed by the disk type.
  • cylinder - Align partitions to cylinders.
  • minimal - Use minimum alignment as given by the disk topology information. This and the opt value will use layout information provided by the disk to align the logical partition table addresses to actual physical blocks on the disks. The min value is the minimum alignment needed to align the partition properly to physical blocks, which avoids performance degradation.
  • optimal Use optimum alignment as given by the disk topology information. This aligns to a multiple of the physical block size in a way that guarantees optimal performance.

Other useful tip is that you can set the size with percentages to get it aligned. Start at 0% and end at 100%. For example:

parted -a optimal /dev/sda mkpart primary 0% 4096MB

share|improve this answer
Should the command not end 0% 100%? Where does 4096MB come from? –  njahnke Jun 8 '14 at 18:08
Value 4096MB is used here just an example to show ability of mixing % and specific size numbers –  lik Jun 9 '14 at 6:24
Just a note, I had to enclose the '0%' in quotes for my shell to execute the command properly. –  Adam Eberlin Jan 26 at 14:48

My solution has been to use gdisk which can perform partitions alignment automatically on a 2048 sectors (1024KiB) by default, although it can be changed in the expert menu.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.