Parted
GNU Parted はパーティションテーブルを作成したり操作するためのプログラムです。GUI フロントエンドとして GParted が存在します。
インストール
公式リポジトリから parted をインストールしてください。
使用方法
Parted には2つのモードがあります: コマンドラインモードとインタラクティブモードです。Parted は以下のように実行します:
# parted device
device
は編集するハードディスクデバイスに置き換えて下さい (例: /dev/sda
)。device
を省略すると、parted が編集するデバイスを推測します。
コマンドラインモード
コマンドラインモードでは、1つまたは複数のコマンドを指定します。例:
# parted /dev/sda mklabel gpt mkpart P1 ext3 1MiB 8MiB
インタラクティブモード
インタラクティブモードでは、コマンドを1つずつ入力し、すぐにディスクに変更が適用されます。例:
(parted) mklabel gpt (parted) mkpart P1 ext3 1MiB 8MiB
コマンドにパラメータを指定しなかった場合、Parted はパラメータを尋ねます。例:
(parted) mklabel New disk label type? gpt
ラウンディング
Since many partitioning systems have complicated constraints, Parted will usually do something slightly different to what you asked. (For example, create a partition starting at 10.352Mb, not 10.4Mb) If the calculated values differ too much, Parted will ask you for confirmation. If you know exactly what you want, or to see exactly what Parted is doing, it helps to specify partition endpoints in sectors (with the "s" suffix) and give the "unit s" command so that the partition endpoints are displayed in sectors.
As of parted-2.4, when you specify start and/or end values using IEC binary units like “MiB”, “GiB”, “TiB”, etc., parted treats those values as exact, and equivalent to the same number specified in bytes (i.e., with the “B” suffix), in that it provides no “helpful” range of sloppiness. Contrast that with a partition start request of “4GB”, which may actually resolve to some sector up to 500MB before or after that point. Thus, when creating a partition, you should prefer to specify units of bytes (“B”), sectors (“s”), or IEC binary units like “MiB”, but not “MB”, “GB”, etc.
ワーニング
Parted will always warn you before doing something that is potentially dangerous, unless the command is one of those that is inherently dangerous (viz., rm, mklabel and mkpart).
アライメント
When creating a partition, parted might warn about improper partition alignment but does not hint about proper alignment. For example:
(parted) mkpart primary fat16 0 32M Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel?
The warning means the partition start is not aligned. Enter "Ignore" to go ahead anyway, print the partition table in sectors to see where it starts, and remove/recreate the partition with the start sector rounded up to increasing powers of 2 until the warning stops. As one example, on a flash drive with 512B sectors, Parted wanted partitions to start on sectors that were a multiple of 2048, which is 1MB alignment.