[RHEL 6] parted reports “Warning: The resulting partition is not properly aligned for best performance.”

 

문제

  • While creating a partition using parted utility, it reports that new partition is misaligned and this may result in very poor performance:
(parted) mkpart primary 128 1048575
Warning: You requested a partition from 128s to 1048575s.                 
The closest location we can manage is 128s to 1048542s.
Is this still acceptable to you?
Yes/No? Yes                                                               
Warning: The resulting partition is not properly aligned for best performance.          <-----
Ignore/Cancel? C  
  • What is the reason for above warning messages? how to eliminate it?

환경

  • Red Hat Enterprise Linux 6
  • Parted

해결

  • When creating the partition using parted utility, please select the start sector value for partition that satisfies one of the following three conditions in algorithm used to determine optimal alignment for the partition:
   1) Always use the reported alignment offset as offset
   2a.  If optimal io size is present in the topology info use that as grain
   2b.  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).
   2c.  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).
  • For example, when optimal io size is not present in topology information, alignment offset is 0 and minimum io size is a power of 2, please select the start sector value for a partition such that it is greater than or equal to 2048 (4k), if start sector value is greater then 2048, then please make sure that it is exactly divisible by 2048:
(parted) p
Model: IET VIRTUAL-DISK (scsi)
Disk /dev/sdf: 1048576s
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart primary 128 1048576
Error: The location 1048576 is outside of the device /dev/sdf.  

(parted) mkpart primary 128 1048575
Warning: You requested a partition from 128s to 1048575s.                 
The closest location we can manage is 128s to 1048542s.
Is this still acceptable to you?
Yes/No? Yes                                                               
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? C                                                          

(parted) mkpart primary 2048 1048575                                  
Warning: You requested a partition from 2048s to 1048575s.                
The closest location we can manage is 2048s to 1048542s.
Is this still acceptable to you?
Yes/No? Yes

(parted) p                                                                
Model: IET VIRTUAL-DISK (scsi)
Disk /dev/sdf: 1048576s
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End       Size      File system  Name     Flags
 1      2048s  1048542s  1046495s               primary 

OR

Get the values as below:

# cat /sys/block/sdb/queue/optimal_io_size
# cat /sys/block/sdb/alignment_offset
# cat /sys/block/sdb/queue/physical_block_size

Now to get the right first sector add optimal_io_size to alignment_offset and then divide the result by physical_block_size.

For example:

optimal_io_size = 1310720
alignment_offset = 0
physical_block_size = 512

i.e 1310720+0/512 = 2560

Now do:

#  mkpart primary 2560 100%    OR

#  mkpart primary 2560 1000G

See How to create a partition with parted for details on creating partition with parted.

근본 원인

  • parted uses the following algorithm to determine optimal alignment for newly created partition, if none of the following conditions viz. 2a, 2b or 2c are satisfied, then 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
   2a.  If optimal io size is present in the topology info use that as grain
   2b.  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).
   2c.  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).

 

포스팅 글도 참조 하면 도움이 된다.

aligned for best performance - parted

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다