Show Table of Contents
このページには機械翻訳が使用されている場合があります (詳細はこちら)。
13.5. fdisk を使用したパーティションのサイズ変更
fdisk
ユーティリティーを使用して、GPT、MBR、Sun、SGI または BSD のパーティションテーブルを作成して操作できます。fdisk
の GUID パーティションテーブル (GPT) サポートは、実験的フェーズにあるため、 GPT を使用しているディスクには、parted
ユーティリティーを使用することが推奨されます。
fdisk
を使用してパーティションサイズを変更する場合は、パーティションを削除して再作成するため、パーティションのサイズを変更する前に、ファイルシステムに保存されているデータをバックアップ してから、手順をテストします。
重要
サイズを変更するパーティションは、そのディスクの最後のパーティションである必要があります。
Red Hat は、LVM パーティションの拡張およびサイズ変更だけをサポートします。
手順13.4 パーティションのサイズ変更
以下の手順は、参照用としてのみ提供しています。
fdisk
を使用してパーティションのサイズを変更します。
- デバイスをアンマウントします。
#
umount /dev/vda
- 以下の例のように、
fdisk disk_name
を実行します。#
fdisk /dev/vda
Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p
オプションで、削除するパーティションのライン番号を確認します。Command (m for help): p Disk /dev/vda: 16.1 GB, 16106127360 bytes, 31457280 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x0006d09a Device Boot Start End Blocks Id System /dev/vda1 * 2048 1026047 512000 83 Linux /dev/vda2 1026048 31457279 15215616 8e Linux LVM
d
オプションで、パーティションを削除します。パーティションが 2 つ以上ある場合は、fdisk
が削除するパーティションの番号を指定するように指示します。Command (m for help): d Partition number (1,2, default 2): 2 Partition 2 is deleted
n
オプションで新しいパーティションを作成し、指示に従います。今後のサイズ変更に必要な容量を十分に確保するようにしてください。(Enter
を押したときの)fdisk
のデフォルトの動作は、デバイスの領域をすべて使用することです。パーティションの末尾は、セクターで指定するか、人が判読できる値を+<size><suffix>
の形式 (例: +500M、+10G) で指定できます。fdisk
は、パーティションの末尾を物理セクターに合わせて調整するため、空き領域をすべて使用したくない場合は、人が判読できるサイズ設定を選択することが推奨されます。(セクター単位で) 実際の数値を指定すると、fdisk
がパーティションの調整を行うことはなくなります。Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): *Enter* Using default response p Partition number (2-4, default 2): *Enter* First sector (1026048-31457279, default 1026048): *Enter* Using default value 1026048 Last sector, +sectors or +size{K,M,G} (1026048-31457279, default 31457279): +500M Partition 2 of type Linux and of size 500 MiB is set
- パーティションのタイプを LVM に設定します。
Command (m for help): t Partition number (1,2, default 2): *Enter* Hex code (type L to list all codes): 8e Changed type of partition 'Linux' to 'Linux LVM'
- 変更が正しければ、
w
を押して変更を書き込みます。書き込みにエラーがあると、選択したパーティションが不安定になる可能性があります。 - デバイスで
e2fsck
を実行し、整合性を確認します。#
e2fsck /dev/vda
e2fsck 1.41.12 (17-May-2010) Pass 1:Checking inodes, blocks, and sizes Pass 2:Checking directory structure Pass 3:Checking directory connectivity Pass 4:Checking reference counts Pass 5:Checking group summary information ext4-1:11/131072 files (0.0% non-contiguous),27050/524128 blocks - デバイスをマウントします。
#
mount /dev/vda
詳細は、fdisk(8) の man ページを参照してください。
このページには機械翻訳が使用されている場合があります (詳細はこちら)。