この製品のマニュアルセットは、偏向のない言語を使用するように配慮されています。このマニュアルセットでの偏向のない言語とは、年齢、障害、性別、人種的アイデンティティ、民族的アイデンティティ、性的指向、社会経済的地位、およびインターセクショナリティに基づく差別を意味しない言語として定義されています。製品ソフトウェアのユーザーインターフェイスにハードコードされている言語、RFP のドキュメントに基づいて使用されている言語、または参照されているサードパーティ製品で使用されている言語によりドキュメントに例外が存在する場合があります。シスコのインクルーシブランゲージに対する取り組みの詳細は、こちらをご覧ください。
シスコは世界中のユーザにそれぞれの言語でサポート コンテンツを提供するために、機械と人による翻訳を組み合わせて、本ドキュメントを翻訳しています。ただし、最高度の機械翻訳であっても、専門家による翻訳のような正確性は確保されません。シスコは、これら翻訳の正確性について法的責任を負いません。原典である英語版(リンクからアクセス可能)もあわせて参照することを推奨します。
このドキュメントでは、Linux仮想マシン(VM)にディスク領域を追加する方法について説明します。
Linux(およびLinux VM)は、ハードディスクにインストールされます(実際のディスクでも仮想ディスクでも)。その上にボリューム・マネージャをスタックし、その後に通常は使用されるファイル・システムをスタックします。
Linux VMの場合、ファイルシステムのサイズを増やすには次の手順が必要です。
注:サイズ変更オプションの多くはRISCであり、VMがブート不能な状態になったり、データが破損したりすることがあります。注意してください。
注:ディスク容量を増やす前に、既存のファイルシステムをクリーンアップしたことを確認してください。多くの場合、/tmp、/var/tmp、/var/tmp/broadhop、および/var/logには不要なファイルがあり、ディスク領域を追加する代わりに削除できます。
#df -hファイルシステム:_____________________________マウント先:_________________________
df -hコマンドの出力例を次に示します。
[root@sessionmgr02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
18G 2.4G 15G 15% /
/dev/mapper/VolGroup00-LogVol02
5.7G 140M 5.3G 3% /home
/dev/mapper/VolGroup00-LogVol03
30G 27G 1.5G 97% /data
/dev/sda1 99M 40M 55M 43% /boot
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 8.0G 1.1G 7.0G 13% /data/sessions.1
# pvdisplayPV名:_____________________________________
pvdisplayコマンドの出力例を次に示します。
[root@sessionmgr02 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 69.89 GB / not usable 18.64 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 2236
Free PE 320
Allocated PE 1916
PV UUID HO3ICX-nRhO-FaBA-MvB3-Zlzv-JLG4-vNFQeU
注:PV名(/dev/sda2)には2つがあります。最初の部分(/dev/sda)はデバイスを示し、2番目の部分(2)はパーティション番号を示します。
追加するディスク領域<amount>:____________________________________
# vgdisplay
Alloc PE /サイズ:________________________フリーPE /サイズ:_________________________
次に、vgdisplayコマンドの出力例を示します。
[root@sessionmgr02 ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 4
Max PV 0
Cur PV 1
Act PV 1
VG Size 74.88 GB
PE Size 32.00 MB
Total PE 2396
Alloc PE / Size 1916 / 59.88 GB
Free PE / Size 480 / 15.00 GB
VG UUID pPSNBU-FRWO-z3aC-iAxS-ewaw-jOFT-dTcBKd
注:この拡張に十分な空き領域がある場合、セクション4に進みます。十分な空き領域がない場合は、この手順を停止し、データストアにディスク領域を追加してから続行します。
# shutdown -h now
次の例は、shutdown -h nowコマンドの出力を示します。
[root@sessionmgr02 ~]# shutdown -h now
Broadcast message from root (pts/0) (Wed Dec 18 11:48:20 2013):
The system is going down for system halt NOW!
注:増加する量は、データストア上の空き領域の量よりも小さくする必要があります。 過剰なプロビジョニングを行わないでください。
注:VMが完全にロードされるまで5分間待機します。
# ssh
次の例は、sshコマンドの出力を示します。
[root@pcrfclient01 ~]# ssh 172.10.1.30
\\Last login: Wed Dec 18 11:48:14 2013 from 172.10.1.9
Spacewalk kickstart on 2010-08-23
[root@sessionmgr02 ~]#
# fdisk -l /dev/sda
ディスクサイズ:_______________________________
次の例は、fdisk -l /dev/sdaコマンドの出力を示します。
[root@sessionmgr02 ~]# fdisk -l /dev/sda
Disk /dev/sda2: 75.0 GB, 75047454720 bytes
255 heads, 63 sectors/track, 9124 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
この出力例は、/dev/sda2に現在75Gが割り当てられていることを示しています。
# fdisk
次の例は、fdisk /dev/sdaコマンドの出力を示します。
[root@sessionmgr02 ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 9137.
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)
Command (m for help):
Command (m for help): p
次の例は、文字「p」を入力した後のパーティションテーブルを示す出力を示しています。
Command (m for help): p
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 9137 73288530 8e Linux LVM
Command (m for help):
開始:_______________________Id:_________________________
Command (m for help): d
次の例は、dを入力した後の結果を示します。
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4):
Partition number (1-4): <number>
次の例は、パーティション番号を入力した後の結果を示しています。
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help):
Command (m for help): n
次の例は、nを入力した後の結果を示します。
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
Command (m for help): n
Command (m for help): p
次の例は、pを入力した後の出力を示します。
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):
Partition number (1-4): 2
次の例は、パーティション番号を入力した後の結果を示しています。
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9137, default 14):
次の例は、デフォルト値を受け入れてEnterキーを押した後の結果を示しています。
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
次の例は、デフォルト値を受け入れてEnterキーを押した後の結果を示しています。
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help):
Command (m for help): t
次の例は、tを入力した後の結果を示します。
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help): t
Partition number (1-4):
Partition number (1-4): 2
次の例は、パーティション番号を入力した後の結果を示しています。
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes):
Hex code (type L to list codes): 8e
次の例は、16進数コードを入力した後の結果を示しています。
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)
Command (m for help):
Command (m for help): w
次の例は、プロンプトでwと入力した後の結果を示しています。
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@sessionmgr02 ~]#
これでfdiskが終了し、ルートプロンプトが表示されます。
# init 6
[root@sessionmgr02 ~]# fdisk -l /dev/sda
Disk /dev/sda2: 80.4 GB, 80418562560 bytes
255 heads, 63 sectors/track, 9777 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
この出力例は、/dev/sdaに80ギガバイトが割り当てられていることを示しています。
警告:この手順は多少危険です。 注意してください。
# pvresize /dev/sda2
次の例は、pvresizeコマンドの入力後の結果を示しています。
[root@sessionmgr02 ~]# pvresize /dev/sda2
Physical volume "/dev/sda2" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
次の例は、vgdisplayコマンドを入力した後の結果を示しています。
[root@sessionmgr02 ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 4
Max PV 0
Cur PV 1
Act PV 1
VG Size 74.88 GB
PE Size 32.00 MB
Total PE 2396
Alloc PE / Size 1916 / 59.88 GB
Free PE / Size 480 / 15.00 GB
VG UUID pPSNBU-FRWO-z3aC-iAxS-ewaw-jOFT-dTcBKd
この例は、前のセクションで追加したディスク領域を示しています。
dfコマンドの出力の値にファイルシステムとマウントを記録します。
# df -h
ファイルシステム:_______________________マウント先:__________________________
[root@sessionmgr02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
18G 2.4G 15G 15% /
/dev/mapper/VolGroup00-LogVol02
5.7G 140M 5.3G 3% /home
/dev/mapper/VolGroup00-LogVol03
30G 27G 1.5G 97% /data
/dev/sda1 99M 40M 55M 43% /boot
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 8.0G 1.1G 7.0G 13% /data/sessions.1
追加するディスク領域<amount>:____________________________
# lvextend -L+5G /dev/mapper/VolGroup-LogVol-03
次の例は、lvextendコマンドの入力後の結果を示しています。
[root@sessionmgr02 ~]# lvextend -L+5G /dev/mapper/VolGroup00-LogVol03
Extending logical volume LogVol03 to 45.00 GB
Logical volume LogVol03 successfully resized
[root@sessionmgr02 ~]#
これにより、新しく追加された領域が論理ボリュームに追加されます。
警告:このコマンドの完了には時間がかかる場合があります。
# resize2fs <filesystem>
次の例は、resize2fsコマンドを入力した後の結果を示します。
[root@sessionmgr02 ~]# resize2fs /dev/mapper/VolGroup00-LogVol03
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/VolGroup00-LogVol03 is
mounted on /data; on-line resizing required
Performing an on-line resize of /dev/mapper/VolGroup00-LogVol03
to 11796480 (4k) blocks.
The filesystem on /dev/mapper/VolGroup00-LogVol03 is now 11796480 blocks long.
[root@sessionmgr02 ~]#
# df -h
df -hコマンドの入力結果の例:
[root@sessionmgr02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
18G 2.4G 15G 15% /
/dev/mapper/VolGroup00-LogVol02
5.7G 140M 5.3G 3% /home
/dev/mapper/VolGroup00-LogVol03
44G 22G 21G 52% /data
/dev/sda1 99M 40M 55M 43% /boot
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 8.0G 4.0K 8.0G 1% /data/sessions.1
改定 | 発行日 | コメント |
---|---|---|
1.0 |
29-Jun-2015 |
初版 |