この項では、ゲストvServerのルート・ディレクトリ(/
)にマウントされたデフォルトの論理ボリュームVolGroup00-LogVol00
のサイズを増やす方法を説明します。
注意:
ここで説明する手順は、EECS 2.0.6.x.xゲスト・ベース・テンプレートを使用して作成したvServerに関連しています。EECSバージョン2.0.6.0.0より前のゲスト・ベース・テンプレートを使用して作成するvServerのディスクの修正に、この手順を使用しないでください。
root
ユーザーとしてvServerにログインします。# df -h
次に、このコマンドの出力例を示します。
Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 5.1G 3.3G 1.6G 68% / /dev/xvda1 99M 23M 71M 25% /boot tmpfs 4.0G 0 4.0G 0% /dev/shm
# cat /proc/partitions major minor #blocks name 202 0 6145024 xvda 202 1 104391 xvda1 202 2 6040440 xvda2 253 0 5505024 dm-0 253 1 524288 dm-1 202 16 104857600 xvdb
/dev/xvdb
は、新しくアタッチされたボリュームです。
fdisk
コマンドを実行します。次に例を示します。注意:
fdisk
コマンドの実行時、様々な段階で必要なユーザー入力は、太字
のテキストで示します。
# fdisk /dev/xvdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. The number of cylinders for this disk is set to 13054. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help): p Disk /dev/xvdb: 107.3 GB, 107374182400 bytes 255 heads, 63 sectors/track, 13054 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-13054, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-13054, default 13054): Using default value 13054 Command (m for help): t Selected partition 1 Hex code (type L to list codes): 8e Changed system type of partition 1 to 8e (Linux LVM) Command (m for help): p Disk /dev/xvdb: 107.3 GB, 107374182400 bytes 255 heads, 63 sectors/track, 13054 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/xvdb1 1 13054 104856223+ 8e Linux LVM Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
# pvcreate /dev/xvdb1
Writing physical volume data to disk "/dev/xvdb1"
Physical volume "/dev/xvdb1" successfully created
VolGroup00
を物理ボリューム/dev/xvdb1
で拡張します。# vgextend VolGroup00 /dev/xvdb1
Volume group "VolGroup00" successfully extended
LogVol00
を拡張します。# lvextend -l +100%FREE /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 105.22 GB
Logical volume LogVol00 successfully resized
# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 27582464 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 27582464 blocks long.
df -h
コマンドを実行して、ゲストvServerのルート・パーティションが更新されたサイズになっていることを確認します。次に例を示します。# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 102G 3.3G 94G 4% / /dev/xvda1 99M 23M 71M 25% /boot tmpfs 4.0G 0 4.0G 0% /dev/shm