LoginSignup
5
3

More than 5 years have passed since last update.

parted の Warning: The resulting partition is not properly aligned for best performance に対処する

Posted at

最近のHDDは容量が大きく、GPT的なパーティションを作成する必要があります。そんなとき Linux では parted を使うわけですが、partd /dev/sdx mklabel gpt したあと partd /dev/sdx mkpart ... したときに次のような警告が表示されることがあります。

# parted /dev/sdh mkpart primary ext4 <開始> <終了>
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel?

ググると、いくつかの解決方法が出てきます

  • /sys 配下の情報をもとに開始、終了位置を計算する
  • 開始に 1 を、終了に -1 を指定する
  • -a optimal を使う
  • etc.

環境によって異なる可能性はありますが、少なくとも私の環境では上記の方法では解決しませんでした。
解決するには、 -a optimal をつけた上で、かつ、開始終了ともに % 表記で指定すればOKです。

# parted -a optimal /dev/sdh mkpart primary ext4 0% 100%

mklabel から通して書くと、

  • 現状のラベル、パーティションを確認
# parted /dev/sdh print
Error: /dev/sdh: unrecognised disk label
Model: ASMT 2105 (scsi)
Disk /dev/sdh: 6001GB
Sector size (logical/physical): 512B/4096B
Partition Table: unknown
Disk Flags:
  • GPTラベルを付与
# parted /dev/sdh mklabel gpt
Information: You may need to update /etc/fstab.

  • ラベルがついたことを確認
# parted /dev/sdh print
Model: ASMT 2105 (scsi)
Disk /dev/sdh: 6001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  Flags

  • パーティション作成。 -a optimal オプションをつけ、開始終了は % 表記にする。
# parted -a optimal /dev/sdh mkpart primary ext4 0% 100%
Information: You may need to update /etc/fstab.

  • パーティションを確認
# parted /dev/sdh print
Model: ASMT 2105 (scsi)
Disk /dev/sdh: 6001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      33.6MB  6001GB  6001GB               primary

5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3