Red Hat Enterprise Linux 6 – Creating a 7TB Partition Using parted Always Shows “The resulting partition is not properly aligned for best performance” Issue

Trying to create a 7TB partition using parted, but parted always complains as follows:

The resulting partition is not properly aligned for best performance

Tried “parted -a optimal“, but the result is same.

(parted) mkpart primary 0 7000G
Aviso: The resulting partition is not properly aligned for best performance. Descartar/Ignore/Cancelar/Cancel?

Solution

Parted uses the following algorithm to determine optimal alignment for newly created partition. If none of the following conditions, 2a, 2b, or 2c are satisfied, then the warning message “The resulting partition is not properly aligned for best performance” would be displayed by parted utility.

  1. Always use the reported alignment offset as offset.

    1. If optimal io size is present in the topology info, use that as grain.

    2. If optimal io size is not present in topology info and alignment offset is 0 and minimum io size is a power of 2, use the default optimal alignment (grain 1MiB).

    3. If not 2a and 2b, use the minimum io size, or if that is not defined the physical sector size as grain (iow the minimum alignment).

In this case, the corresponding sysfs values are:

# cat /sys/block/sdb/queue/optimal_io_size
1835008
# cat /sys/block/sdb/queue/minimum_io_size
262144
# cat /sys/block/sdb/alignment_offset
0
# cat /sys/block/sdb/queue/physical_block_size
512

With a sector count of 13674214832 for the disk, 13674214831 should be used as the end sector for using parted on this disk.

With the optimal_io_size value 1835008 exceeding 1MiB, parted wants to align to the optimal_io_size. 1835008 / 512 = 3584 sectors for the optimal size in sectors. The start of a partition should be a multiple of 3584 sectors for optimal performance. To make a single partition for this disk with this alignment, the parted command:

mkpart p ext2 3584s 13674214831s

This should generate a partition with the optimal alignment and should avoid the warning too.

(parted) mkpart p ext2 3584s 13674214831s
Warning: You requested a partition from 1835kB to 7001GB
The closest location we can manage is 1835kB to 7001GB
Is this still acceptable to you? Yes/No? Yes

(parted) unit s p
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sdb: 13674214832s
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size Filesystem Name Flags 1 3584s 13674214798s 13674211215s p