手順1 VMware の仮想ディスクを拡張する
- VMware の仮想ディスクの拡張には vmware-vdiskmanager を使う。
- vmware-vdiskmanager は VMware Player にはバンドルされていない。VMware Workstation に付随している。
- vmware-vdiskmanager の使い方は -help で代替分かる。
以下、仮想ディスクを40GBにする方法
(40GBを追加するんじゃなくってトータルで40GBにする)
なお、下記はすごーく時間がかかるので、新しいVMを作ってOSインストールした方がはやいぐらい。作った環境を維持したい場合にのみ利用するのを薦める
cd "C:\Documents and Settings\hoge\My Documents\My Virtual Machines\Windows XP Home Edition" C:\Documents and Settings\hoge\My Documents\My Virtual Machines\Windows XP Home Edition>"C:\Program Files\VMware\VMware Workstation\vmware-vdiskmanager.exe" -x 40GB "Windows XP Home Edition.vmdk" Disk expansion completed successfully. WARNING: If the virtual disk is partitioned, you must use a third-party utility in the virtual machine to expand the size of the partitions. For more information, see: http://www.vmware.com/support/kb/enduser/std_adp.php?p_faqid=1647
手順2 GParted を使ってパーティションを広げる
この段階では VM上のOSにはディスクの増加が認識されていない。
VMで GParted を使ってパーティションの変更をする。
- GParted のISOイメージをホストOSにダウンロードする
- VMwareの設定でDVDにISOイメージをマウントする。VMwareWorkstation の場合 。Workstation-> VM-> 設定-> CD/DVD(IDE)-> ISOイメージファイルを使用する。 ISOイメージファイル名を入力。接続済み、起動時に接続をON
- VM再起動
- F2キーでBIOS設定に移る。(*.vmx でbios.bootDelay="3000" とかしておくと 3秒待ってくれる)
- ブートデバイスの設定でCDをハードディスクより上にして起動しなおす
- GParted が起動したらディスク領域を広げる。Apply忘れんな。
- VM一度シャットダウン
- VMの DVD の設定をもとの物理ドライブを使用するに戻す。
- VM起動 ゲストOS立ち上がるはず。fcsk的なものが走るが気長にまつ。
手順3 Linix にログインして論理ボリュームを拡大する
# lvdisplay --- Logical volume --- LV Path /dev/vg_centos6/lv_root LV Name lv_root VG Name vg_centos6 LV UUID Ge0Cxk-srlM-gxeM-d3pY-873F-k3fM-f9YC8r LV Write Access read/write LV Creation host, time centos6.5-hoge, 2014-02-01 00:34:58 +0900 LV Status available # open 1 LV Size 50.00 GiB Current LE 12800 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 --- Logical volume --- LV Path /dev/vg_centos6/lv_home <- 論理ボリューム名 LV Name lv_home VG Name vg_centos6 LV UUID nwmPMf-jwna-wO76-CW9S-w2uL-T4Ns-UzfjxF LV Write Access read/write LV Creation host, time centos6.5-hoge, 2014-02-01 00:35:05 +0900 LV Status available # open 1 LV Size 60.72 GiB Current LE 15544 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:2 --- Logical volume --- LV Path /dev/vg_centos6/lv_swap LV Name lv_swap VG Name vg_centos6 LV UUID 9ODGio-MPih-S7ZG-MZ8f-XbcZ-oH3D-I9etGJ LV Write Access read/write LV Creation host, time centos6.5-hoge, 2014-02-01 00:35:09 +0900 LV Status available # open 1 LV Size 8.79 GiB Current LE 2250 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 # vgdisplay --- Volume group --- VG Name vg_centos6 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 3 Max PV 0 Cur PV 1 Act PV 1 VG Size 299.51 GiB PE Size 4.00 MiB Total PE 76674 Alloc PE / Size 30594 / 119.51 GiB Free PE / Size 46080 / 180.00 GiB <- 空き容量 VG UUID 1x3iII-wdIR-vhZk-8528-SlC3-3DcM-iek66q # lvextend -L +180G /dev/vg_centos6/lv_home Extending logical volume lv_home to 240.72 GiB Logical volume lv_home successfully resized # resize2fs /dev/vg_centos6/lv_home resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/vg_centos6/lv_home is mounted on /home; on-line resizing required old desc_blocks = 4, new_desc_blocks = 16 Performing an on-line resize of /dev/vg_centos6/lv_home to 63102976 (4k) blocks. The filesystem on /dev/vg_centos6/lv_home is now 63102976 blocks long.
以上