在VMware6.0安装目录下有一个命令行工具——vmware-vdiskmanager.exe 程序,可用来修改虚拟机硬盘的大小。方法如下:

    1、关闭虚拟机电源;启动Windows下的命令提示符界面;

    2、通过 cd 命令进入VMware的安装目录(如:D:/VMwareWS-v6.0),输入“vmware-vdiskmanager”后按回车键,可显示关于该命令的说明。

    3、执行如下命令:

    vmware-vdiskmanager -x l2Gb D:/redhat/redhat*.vmdk

    参数 -x 表示要扩展虚拟机硬盘空间;紧随其后的数字指要扩展的大小(如12Gb,表示磁盘总量,包含原来的磁盘容量);最后是要操作的虚拟机Linux的具体文件。

    【注意】若路径名中有空格,必须以双引号括起来。

    执行完毕,退出命令提示符窗口,重启VMware,这时虚拟机硬盘空间已变成12GB了。


转自:

界面中并没有提供增加硬盘容量的方法。

只能在命令行形式下执行。

安装所在盘的Program Files/VMware/VMware Workstation下有一个vmware-vdiskmanager.exe,就是它。

命令参数如下:
------------------------------------------------------------------

Usage: vmware-vdiskmanager.exe OPTIONS <disk-name> | <mount-point>

 Offline disk manipulation utility

    Options:
       -c                    : create disk; need to specify other create options
       -d                    : defragment the specified virtual disk
       -k                    : shrink the specified virtual disk
       -n <source-disk>      : rename the specified virtual disk; need to
                              specify destination disk-name
       -p                    : prepare the mounted virtual disk specified by
                              the drive-letter for shrinking
       -q                    : do not log messages
       -r <source-disk>      : convert the specified disk; need to specify
                              destination disk-type
       -x <new-capacity>     : expand the disk to the specified capacity

       Additional options for create and convert:
          -a <adapter>       : (for use with -c only) adapter type (ide, buslogic o
 r lsilogic)
          -s <size>          : capacity of the virtual disk
          -t <disk-type>     : disk type id

       Disk types:
          0                  : single growable virtual disk
          1                  : growable virtual disk split in 2Gb files
          2                  : preallocated virtual disk
          3                  : preallocated virtual disk split in 2Gb files

       The capacity can be specified in sectors, Kb, Mb or Gb.
       The acceptable ranges:
                             ide adapter : [100.0Mb, 950.0Gb]
                             scsi adapter: [100.0Mb, 950.0Gb]

          ex 1: vmware-vdiskmanager.exe -c -s 850Mb -a ide -t 0 myIdeDisk.vmdk
          ex 2: vmware-vdiskmanager.exe -d myDisk.vmdk
          ex 3: vmware-vdiskmanager.exe -r sourceDisk.vmdk -t 0 destinationDisk.vm
 dk
          ex 4: vmware-vdiskmanager.exe -x 36Gb myDisk.vmdk
          ex 5: vmware-vdiskmanager.exe -n sourceName.vmdk destinationName.vmdk
          ex 6: vmware-vdiskmanager.exe -k myDisk.vmdk
          ex 7: vmware-vdiskmanager.exe -p <mount-point>
                (A virtual disk first needs to be mounted at <mount-point>)


-----------------------------------------------------------------
其中的-x参数就是用来扩容的……

如这个:vmware-vdiskmanager.exe -x 36Gb myDisk.vmdk


-------------------------------------------------------

我的执行过程:

E:/Program Files/VMware/VMware Workstation>set path=%path%;E:/Program Files/VMwa
 re/VMware Workstation

 E:/Program Files/VMware/VMware Workstation>e:

 E:/Program Files/VMware/VMware Workstation>cd E:/VM_Machine

 E:/VM_Machine>cd Windows Server 2003 Standard Edition

 E:/VM_Machine/Windows Server 2003 Standard Edition>dir *.vmdk

 2007/07/20   11:17         1,588,527,104 Windows Server 2003 Standard Edition-s001
 .vmdk
 2007/07/20   11:17                65,536 Windows Server 2003 Standard Edition-s002
 .vmdk
 2007/07/20   10:56                   448 Windows Server 2003 Standard Edition.vmdk

E:/VM_Machine/Windows Server 2003 Standard Edition>vmware-vdiskmanager.exe -x 4G
 "Windows Server 2003 Standard Edition.vmdk"
 Using log file C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/1/vmware-Administrator/vdiskma
 nager.log
 The specified disk size does not fall within acceptable range.
 The acceptable ranges:
                        ide adapter : [100.0Mb, 950.0Gb]
                        scsi adapter: [100.0Mb, 950.0Gb]

 E:/VM_Machine/Windows Server 2003 Standard Edition>vmware-vdiskmanager.exe -x 4G
 b "Windows Server 2003 Standard Edition.vmdk"
 Using log file C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/1/vmware-Administrator/vdiskma
 nager.log
 The old geometry C/H/S of the disk is: 261/255/63
 The new geometry C/H/S of the disk is: 522/255/63
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 ===============================================================

===
总结一下:
1。文件名应该用双引号括起来。
2。vmdk文件用不带001,002的最短的那个文件名。
3。GB,MB,别忘了B。

 

需要强调的一点是,调整硬盘大小之后的效果,相当于增加了原来物理硬盘的柱面数目,因此,文件系统并不会自动增长。需要重新调整文件系统的大小。这一步不同的系统有不同的方法。比如
1. 如果guest OS为win系列,可以通过partion magic来实现
2. 如果guest OS为Linux系列,可以通过 resize2fs来扩大ext2/3格式的文件系统。
3. 如果guset OS为其他Unix系统,可以通过向文件树中新增加分区,来扩充原文件系统。

通过vm加盘的方法:在菜单栏哪里有个“VM”,点击“VM”里面有个“settings”或者直接用快捷键“Ctrl+D”,点击“Add”增加一个“Hard Disk”.加完后进入系统后,右击我的电脑选择“管理”进入后再选择“存储”中的“磁盘管理”。对你刚才新增加的硬盘进行快速格式化后,就可以为你原先的硬盘多增加一个盘符=已经扩大你原先的硬盘大小