[VMWare] 仮想ディスクの容量追加

移転しました。

参考ページそのまま
http://as-is.net/blog/archives/001186.html

Windows上で以下コマンド実行.(容量とかファイル名は置き換える)

vmware-vdiskmanager.exe -x 10Gb vdisk.vmdk

仮想OS上で以下実行 (CentOS5)

# /sbin/fdisk /dev/hda -l

Disk /dev/hda: 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/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        1044     8281507+  8e  Linux LVM
# /sbin/fdisk /dev/hda

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): 3
First cylinder (1045-1305, default 1045): 1045
Last cylinder or +size or +sizeM or +sizeK (1045-1305, default 1305): 1305

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 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.
# reboot

(再起動)

# /sbin/fdisk -l

Disk /dev/hda: 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/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        1044     8281507+  8e  Linux LVM
/dev/hda3            1045        1305     2096482+  8e  Linux LVM

最後に

# /usr/sbin/pvcreate /dev/hda3
# /usr/sbin/vgextend VolGroup00 /dev/hda3
# /usr/sbin/lvextend -L +2G /dev/VolGroup00/LogVol00
# /sbin/resize2fs /dev/VolGroup00/LogVol00
# df -k