2017年8月22日 星期二

How to clone vmware image inside vmware Esxi server through ssh terminal.

最近拿到兩台舊版的VMWARE Esxi server 可以用來玩系統,發現要deploy ova tempalte實在有夠麻煩,查了一下似乎

可以直接再vwmare 裡面直接clone image 這樣速度最快,下列是從vmware 官網直接複製天上的說明步驟

 

Cloning a virtual machine disk without delta files or snapshots

To clone a virtual machine disk using the ESXi/ESX host terminal:

  1. Log in to the terminal of the ESXi/ESX host. (需要先開啟ssh 的服務  Configuration-> Security Profile : Enable SSH)

  2. Navigate to the virtual machine's directory using the cd command. It is located at:

    /vmfs/volumes/source_datastore/virtual_machine/    (我的預設是/vmfs/volumes/datastore1)
  3. Confirm the destination directory where the clone will be copied to. Create this directory, if required.

    For example, if this destination directory does not exist:

    /vmfs/volumes/destination_datastore/virtual_machine/

    Create the directory using this command:

    mkdir /vmfs/volumes/destination_datastore/virtual_machine/

  4. Clone the virtual hard disk using the vmkfstools -i command after shutting down the virtual machine:

    # vmkfstools -i /vmfs/volumes/Storage1/examplevm/examplevm.vmdk /vmfs/volumes/Storage2/examplevm_clone.vmdk

    You see output similar to:

    Destination disk format: VMFS thick
    Cloning disk '/vmfs/volumes/Storage1 (3)/examplevm/examplevm.vmdk'...
    Clone: 100% done.


    Notes

    • Encapsulate objects with quotes where appropriate to ensure spaces and other special characters are interpreted correctly. 
    • By default, the vmkfstools -i command will create a destination thick provisioned disk. If you want the destination disk to be thin provisioned, add -d thinto the end of the preceding command.

      For example:

      # vmkfstools -i /vmfs/volumes/Storage1/examplevm/examplevm.vmdk /vmfs/volumes/Storage2/examplevm_clone.vmdk -d thin

Cloning a virtual machine disk with delta files or snapshots

To clone a virtual machine disk using the ESXi/ESX host terminal:

  1. Log in to the ESXi/ESX host's terminal. 

  2. Navigate to the virtual machine's directory using the cd command. It is located at:

    /vmfs/volumes/source_datastore/virtual_machine/

  3. Confirm the destination directory where the clone will be copied to. Create this directory, if required.

    For example, if this destination directory does not exist:

    /vmfs/volumes/destination_datastore/virtual_machine/

    Create the directory using this command:

    mkdir /vmfs/volumes/destination_datastore/virtual_machine/

  4. Clone the virtual hard disk from its current snapshot delta point using the vmkfstools -i command.

    # vmkfstools -i /vmfs/volumes/Storage1/examplevm/examplevm-000003.vmdk /vmfs/volumes/Storage2/examplevm_clone.vmdk

    You see output similar to:

    Destination disk format: VMFS thick
    Cloning disk '/vmfs/volumes/Storage1 (3)/examplevm/examplevm-000003.vmdk'...
    Clone: 100% done.

沒有留言:

How to restore a deleted onenote page

復原不小心誤刪的onenote