VirtualMachineにディスクを追加する

関連エントリ
LVM:PhysicalVolumeを定義する - 明日=今日×(反省+前向き)+努力
LVM:PVをVolumeGroupに追加する - 明日=今日×(反省+前向き)+努力
LVM:VolumeGroup(VG)からLogicalVolume(LV)を作成する - 明日=今日×(反省+前向き)+努力


FedoraCoreをインストールしたVMware構成でふと?ディスク2GBしか用意していませんでした。しかもデフォルトで作ったからLVMになってる!ディスク追加とLVMの再構成をしてみました。

VMwareにディスクを追加する。

  1. ゲストOSをPowerOff
  2. VM >> Settings >> Hardware タブで"Add"ボタンを押し、起動されるウィザードに従って進めます。
  3. SCSIモデルのHDDを選択し、容量は10GBとした。"Allocate all disk space now."のチェックボックスは外しておき、ホスト上のディスクイメージファイルは必要に応じて拡張するようにしました。

ゲストOSで設定する。


追加した10GBのディスクが確認できます

# fdisk -l

Disk /dev/sda: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 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         261     1992060   8e  Linux LVM

Disk /dev/sdb: 10.7 GB, 10737418240 bytes       <=★追加された
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table


ディスクパーティションを作成

# fdisk /dev/sdb

The number of cylinders for this disk is set to 1305.
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): n       <=★入力
Command action
   e   extended
   p   primary partition (1-4)
p                  <=★入力
Partition number (1-4): 1      <=★入力
First cylinder (1-1305, default 1):  <=★空Enter
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):  <=★空Enter
Using default value 1305

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/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1305    10482381   8e  Linux LVM  <=★LVM用に変更された

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


fdiskのオプションは以下の通り

Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

明日はLVMの設定を行います。