Tag: vmware

  • Clone VM on VMware ESXi using vmkfstools

    Clone VM on VMware ESXi using vmkfstools

    Free version of VMware ESXi don’t provide option to clone virtual machine. If you want to clone a VM, you need to purchase expensive vSphere license.

    There is a work around for this, you need to clone disk of an existing Virtual machine using vmkfstools.

    To make clone of a VM disk, SSH into your VMWare ESXi server as user root. Then create clone of disk with

    vmkfstools -i "source.vmdk" "destination.vmdk"
    

    For new VM, i created a directory. Path to datastore directory may be differnt on your server, you can find it using “df -h” command and checking the file system.

    mkdir /vmfs/volumes/disk2/ubuntu-clone/
    

    Shutdown the Virtual Machine you want to clone the disk from. Run

    [root@ns3048991:~] vmkfstools -i "/vmfs/volumes/disk2/Ubuntu/Ubuntu.vmdk" "/vmfs/volumes/disk2/ubuntu-clone/ubuntu-clone.vmdk"
    Destination disk format: VMFS zeroedthick
    Cloning disk '/vmfs/volumes/disk2/Ubuntu/Ubuntu.vmdk'...
    Clone: 100% done.
    [root@ns3048991:~] 
    

    In screenshot below, i first tried to clone with out creating destination folder. That resulted in error. After creating destination folder, vmkfstools command worked.

    vmkfstools

    Creating VM using cloned disk

    Login to VMware ESXi web interface. Create a new VM. On the step where you select hardware, delete the existing Disk. Add a new disk, browse and select the newly created clone disk. In this case – “/vmfs/volumes/disk2/ubuntu-clone/ubuntu-clone.vmdk”

    VMWare ESXi

    Once the VM creation is finished, you will be able to start the new VM. You can create a VM, then use it as the template for creating new virtual machines.

    See VMWare

  • VMWare ESXI add SSH key

    To enable password less SSH login on VMWare ESXI server, add your SSH key to file

    /etc/ssh/keys-root/authorized_keys
    
  • VMware ESXi set Virtual Machine to start on Boot

    VMware ESXi set Virtual Machine to start on Boot

    To set Virtual machine to start on boot, Go to

    VMware ESXi > Virtual Machines
    

    Click on the Virtual machine you need to start on Boot.

    From Actions Menu, select “Autostart” click “Enable”

  • Create Virtual Machine in VMware ESXi Server

    To create Virtual Machine, login to VMware ESXi, click on “Create/Register VM” link on top.

    Create VM

    On next page, it ask you to “Select creation type”.

    Select “Create a new virtual machine”. Click next.

    On next page, you need to “Select a name and guest OS”.

    It ask for datastore, select the datastore you need to use for your VM.

    On “Customize settings” page you need to select Virtual Machine CPU/RAM/Disk etc..

    If you need to boot from ISO, set “CD/DVD Drive 1” to “Datastore ISO file”. This will show you datastore browser, you need to select the ISO file you need to install. Make sure you select “Connect at power on” option for VM to boot from ISO file.

    On next screen, it shows information about the virtual machine you are going to create.

    Click “Finish” to create the Virtual Machine.

    Click on “Virtual Machines” link on left side menu, you will see all your Virtual Machines

    Click on the VM to start the Virtual Machine, this will boot the VM from ISO, you can do the installation of Guest OS.

    Posted in vmware