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

From MyWiki

Jump to: navigation, search

I needed to create a missing GPT petition and hit "Warning: The resulting partition is not properly aligned for best performance." coming from parted.

The first mistake I made was an attempt to create the partition with fdisk:

# fdisk -l /dev/sdc

WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdc: 4000.8 GB, 4000787030016 bytes
255 heads, 63 sectors/track, 486401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1      267350  2147483647+  ee  GPT

which resulted in missing device:

[root@24kmz12.r04.az1.cust.pdx.wd alex.markelov]# mkfs.xfs /dev/sdc1
/dev/sdc1: No such file or directory

After thinking more and doing some RTFM, I went to correct myself and used parted, but the warning about alignment stood in the way.

These two resources helped to overcome the problem:

In this case I had to use the HP way, since optimal_io_size was 0:

# cat /sys/block/sdc/queue/optimal_io_size
0
# cat /sys/block/sdc/queue/minimum_io_size
512
# cat /sys/block/sdc/alignment_offset
0
# cat /sys/block/sdc/queue/physical_block_size
512

1 MiB alignment was the way to go:

# parted  /dev/sdc -- mklabel gpt

[root@24kmz12.r04.az1.cust.pdx.wd alex.markelov]# parted  /dev/sdc --  mkpart primary xfs 1MiB -1s
Warning: You requested a partition from 1049kB to 4001GB.
The closest location we can manage is 1049kB to 4001GB.
Is this still acceptable to you?
Yes/No? Yes
Information: You may need to update /etc/fstab.

# parted /dev/sdc
GNU Parted 2.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: SEAGATE ST4000NM0023 (scsi)
Disk /dev/sdc: 4001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  4001GB  4001GB               primary

(parted) quit

# ls -l /dev/sdc*
brw-rw---- 1 root disk 8, 32 Jul 22 14:02 /dev/sdc
brw-rw---- 1 root disk 8, 33 Jul 22 14:01 /dev/sdc1

# mkfs.xfs /dev/sdc1
meta-data=/dev/sdc1              isize=256    agcount=4, agsize=244188597 blks
         =                       sectsz=512   attr=2, projid32bit=0
data     =                       bsize=4096   blocks=976754385, imaxpct=5
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=476930, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

And that was it.

If optimal_io_size would be greater than zero, then then I would have to add optimal_io_size to alignment_offset and divide the result by physical_block_size.

Personal tools