虚拟机分硬盘小了,拜我120G硬盘所赐。今天终于不够用了,所以网上找了一下虚拟机增加硬盘容量的方法。实现过程如下。windows下的。

vm安装目录下有一个vmware-vdiskmanager.exe命令,就用它了。

命令说明:

E:\VMware\VMware Workstation>vmware-vdiskmanager.exe
VMware Virtual Disk Manager - build 13124.
Usage: vmware-vdiskmanager.exe OPTIONS diskName | drive-letter:
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      : 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      : convert the specified disk; need to specify
                            destination disk-type
     -x     : expand the disk to the specified capacity

     Additional options for create and convert:
        -a       : adapter type (ide, buslogic or lsilogic)
        -s          : capacity of the virtual disk
        -t     : 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 m:
              (A virtual disk first needs to be mounted at m:
               using the VMware Diskmount Utility.)

-X这个参数就是扩容的。以下是实现过程:

E:\>cd E:\My Virtual Machines\Windows Server 2003 Enterprise Edition   (先找到vm的*.vmdk文件)

E:\My Virtual Machines\Windows Server 2003 Enterprise Edition>dir
 驱动器 E 中的卷没有标签。
 卷的序列号是 8036-3B32

 E:\My Virtual Machines\Windows Server 2003 Enterprise Edition 的目录

2009-06-03  16:43              .
2009-06-03  16:43              ..
2009-06-02  17:15            34,093 vmware-0.log
2009-06-01  18:49            39,327 vmware-1.log
2009-05-31  19:26            36,310 vmware-2.log
2009-06-03  02:31            42,475 vmware.log
2009-06-03  02:31             8,664 Windows Server 2003 Enterprise Edition.nvram

2009-06-03  16:43     4,717,281,280 Windows Server 2003 Enterprise Edition.vmdk
2009-03-31  00:19                 0 Windows Server 2003 Enterprise Edition.vmsd
2009-06-03  16:43             1,020 Windows Server 2003 Enterprise Edition.vmx
2009-06-03  16:42                 0 Windows Server 2003 Enterprise Edition.vmx.l
ck
               9 个文件  4,717,443,169 字节
               2 个目录 36,122,193,920 可用字节
E:\My Virtual Machines\Windows Server 2003 Enterprise Edition>cd E:\VMware\VMwar (找到VM的安装路径)
e Workstation

E:\VMware\VMware Workstation>set path=%path%;E:\VMware\VMware WorkStation

E:\VMware\VMware Workstation>cd E:\My Virtual Machines\Windows Server 2003 Enter
prise Edition
命令要按照下面的格式写
E:\My Virtual Machines\Windows Server 2003 Enterprise Edition>vmware-vdiskmanage  
r.exe -x 4Gb "Windows Server 2003 Enterprise Edition.vmdk"
Using log file C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\vdiskmanager.log
Failed to expand the disk 'Windows Server 2003 Enterprise Edition.vmdk': One of
the parameters supplied is invalid. (1)
 
这里出现个个错误,原因是 -X后面跟的大小是扩容后的大小,而不是增量,还有,一定要是Gb||Mb,所以这样就ok了
 
E:\My Virtual Machines\Windows Server 2003 Enterprise Edition>vmware-vdiskmanage
r.exe -x 10Gb "Windows Server 2003 Enterprise Edition.vmdk"
Using log file C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\vdiskmanager.log
  Grow: 100% done.
The old geometry C/H/S of the disk is: 783/255/63
The new geometry C/H/S of the disk is: 1305/255/63
Disk expansion completed successfully.

E:\My Virtual Machines\Windows Server 2003 Enterprise Edition>

Enjoy it

留下评论

Your email address will not be published. Required fields are marked *