由于对linux下的磁盘管理不是很清楚,在MAC上对VMware Fusion扩容浪费了很多时间。今天终于搞定了。


一、Resize partitons of VMware Fusion

1. shut down the running VMs.

2. Virtual Machine->Hard Disk (SCSI)->Hard Disk(SCSI) settings, drag the slider to the new hard disk capacity, or just type whichever number you wish into the size box and hit enter. The save button will un-grey and let you make the changes.sizeguisave.png

二、Since my guest OS in the VMware Fusion is Linux, I need to extend partitions on linux VMware virtual machines. [Ref link: http://www.techrepublic.com/blog/smbit/extending-partitions-on-linux-vmware-virtual-machines/286]

  1. Connect to the command line of the Linux VM via the console or putty session

  2. Log in as root

  3. The fdisk command provides disk partitioning functions and using it with the -l switch lists information about your disk partitions.  At the command prompt type fdisk -l

  4. The response should say something like Disk /dev/sda : xxGB. (See Figure A)

  5. At the command prompt type fdisk /dev/sda. (if dev/sda is what was returned after step one as shown in Figure A)

  6. Type p to print the partition table and press Enter (also shown in Figure A)

  7. Type n to add a new partition

  8. Type p again to make it a primary partition

  9. Now you’ll be prompted to pick the first cylinder which will most likely come at the end of your last partition (ex: /dev/sda3 ends at 2610).  So I chose 2611 for my first cylinder, which is also listed as the default.

  10. If you want it to take up the rest of the space available, just choose the default value for the last cylinder.

  11. Type w to save these changes

  12. Restart the VM

  13. Log back in as root

  14. At the command prompt type fdisk -l. You’ll notice another partition is present.  In Figure Bit is listed as sda4.

  15. You need to initialize this new partition as a physical volume so you can manipulate it later using the Logical Volume Manager (LVM). Command: #pvcreate /dev/sda [ref link: https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Logical_Volume_Manager_Administration/physvol_admin.html]

  16. Now you’ll add the physical volume to the existing volume group using the vgextend command. First type df -h to find the name of the volume group.  In Figure C, the name of the volume group is vg_root. Now type vgextend [volume group] /dev/sdaX. (ex: vgextend vg_root /dev/sda4)

  17. To find the amount of free space available on the physical volume type vgdisplay [volume group] | grep “Free”

  18. Extend the logical volume by the amount of free space shown in the previous step by typing lvextend  -L+[freespace]G /dev/volgroup/volume. (ex: lvextend -L+20G /dev/vg_root/lv_root)

  19. You can finally expand the ext3 file system in the logical volume using the commandresize2fs /dev/volgroup/volume (ex: resize2fs /dev/vg_root/lv_root).

  20. You can now run the df command to verify that you have more space–df -h

Figure A

extending-linux-parts-a1.png

Figure B

extending-linux-parts-b.png

Figure C

extending-linux-parts-c.png