vmware workstation的多個vmdk轉換成單個vmdk


將多個vmware的vmdk文件轉化成單個文件的方法

通過vmware workstation軟件創造出來的虛擬機,在虛擬機目錄下有時會出現多個以vmdk后綴名結尾的文件,多個文件占用的空間都很大,感覺很亂,並且這樣虛擬機運行的效率也很低。

出現這種情況的原因是在創建虛擬機時,在指定硬盤容量時,選擇了Split virtual disk into multiple files(將虛擬磁盤分割為多個文件),並且下面有說明,這種多個文件模式更易於將虛擬機轉移到其他的電腦上,並且會降低性能且會占用更多的硬盤空間

如果選擇Store virtual disk as a single file模式,虛擬機就會在一個文件中,不僅會提高性能減少占用硬盤空間,而且看着更舒服。

但是這兩個模式之間可以轉換嗎,通過vmware workstation自帶的一個工具就可以做到。

在vmware workstation的安裝目錄下,有一個vmware-vdiskmanager.exe文件,在命令行下執行,可以看到這個軟件的用法,如下:

VMware Virtual Disk Manager – build 471780.
Usage: vmware-vdiskmanager.exe OPTIONS <disk-name> | <mount-point>
Offline disk manipulation utility
  Operations, only one may be specified at a time:
     -c                   : create disk.  Additional creation options must
                            be specified.  Only local virtual disks can be
                            created.
     -d                   : defragment the specified virtual disk. Only
                            local virtual disks may be defragmented.
     -k                   : shrink the specified virtual disk. Only local
                            virtual disks may be shrunk.
     -n <source-disk>     : rename the specified virtual disk; need to
                            specify destination disk-name. Only local virtual
                            disks may be renamed.
     -p                   : prepare the mounted virtual disk specified by
                            the mount point for shrinking.
     -r <source-disk>     : convert the specified disk; need to specify
                            destination disk-type.  For local destination disks
                            the disk type must be specified.
     -x <new-capacity>    : expand the disk to the specified capacity. Only
                            local virtual disks may be expanded.
     -R                   : check a sparse virtual disk for consistency and atte
mpt
                            to repair any errors.
     -e                   : check for disk chain consistency.
     -D                   : make disk deletable.  This should only be used on di
sks
                            that have been copied from another product.

  Other Options:
     -q                   : do not log messages

  Additional options for create and convert:
     -a <adapter>         : (for use with -c only) adapter type
                            (ide, buslogic, lsilogic). Pass lsilogic for other a
dapter types.
     -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
      4                   : preallocated ESX-type virtual disk
      5                   : compressed disk optimized for streaming
      6                   : thin provisioned virtual disk – ESX 3.x and above

     The capacity can be specified in sectors, KB, MB or GB.
     The acceptable ranges:
                           ide adapter : [1MB, 2040.0GB]
                           scsi adapter: [1MB, 2040.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 -r sourceDisk.vmdk -t 4 -h esx-name.mycomp
any.com \
              -u username -f passwordfile “[storage1]/path/to/targetDisk.vmdk”
        ex 7: vmware-vdiskmanager.exe -k myDisk.vmdk
        ex 8: vmware-vdiskmanager.exe -p <mount-point>
              (A virtual disk first needs to be mounted at <mount-point>)

用法已經說的很清楚了,這里假設需要轉化的虛擬機位於F:windows.vmdk,那么通過以下命令操作來實現將多個vmdk文件轉化成一個文件:

vmware-vdiskmanager.exe -r “F:\windows.vmdk” -t 0 “F:\b.vmdk”

"C:\Program Files (x86)\VMware\VMware Workstation\vmware-vdiskmanager.exe" -r "E:\software\軟件\win10\Windows 10 x64.vmdk" -t 0 MyNewImage.vmdk

注意目標文件和源文件名不能一樣,轉換后原有虛擬機仍然存在,刪除並新建后,使用現有磁盤添加新的vmdk文件即可。

 

本文轉載於:http://www.eumz.com/2013-07/946.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM