In the attached video, I will demonstrate how to clone a VM from its original location to a new folder using PuTTY«. We will then create a new Virtual Machine (VM) using the existing Hard Drive, also known as the vmdk. This method makes it easier and faster to get a new Server up and running and connected to an already live Server infrastructure.
The following scripts are what are used for cloning or copying Virtual Machines in either SSH« or a third-party program, such as PuTTY«
We use the CD (Change Directory) command to change to a folder.
'-- To go into a single folder.
cd vmfs
'-- To go multiple folders deep.
cd vmfs/volumes/
'-- To go back 1 folder
cd ..
'--To go back to the Root, type the following and hit [Enter] andthen [Enter] again at the Greater Bracket.
cd\
'-- To get the Datastore number that corresponds with the datastore name.
'-- (LS but lowercase) The top LEFT folder SHOULD be the Datastore.
ls
'-- Example
[root@localhost:/vmfs/volumes] ls
60b827f2-a53c1062-fbd9-848f69defff7 a58601e3-934691cf-d2ce-c0b3ec164811
630befcd-85d18a16-82a2-848f69defff7 adb4b8ee-414b41da-c436-b773dd16ac0e
'-- The top left is my datastore. To enter the store, do this.
[root@localhost:/vmfs/volumes] cd 60b827f2-a53c1062-fbd9-848f69defff7
Important
Single LineMake sure this is all on the same line, or it will not work.
vmkfstools -i"/vmfs/volumes/60b827f2-a53c1062-fbd9-848f69defff7/011-Web-02/011-Web-02.vmdk""/vmfs/volumes/60b827f2-a53c1062-fbd9-848f69defff7/005-Web-05/011-Web-05.vmdk"-d thin -a buslogic
If you missed renaming the VM in the cloning above, you can rename it with this.