ESXi

 View Only
  • 1.  VM Backup

    Posted Jul 06, 2011 08:40 AM

    Hi,

    I need to take the backup of VM. Can anyone please let me know how this can be happen.

    ***I have no backup software installed on VM.

    ***No chnage window to shutdown the machine.

    ***VM cant be taken offline to download the vmdk file from datastore.

    Is there anyway that i can take the backup of online/active VM???

    Steps taken:

    I tried to download the .vmdk file using Winscp tool, but it is saying copying failed. "Received error message from remote side: 'scp: AUSESX4VM10.vmdk: Device or resource busy."

    Any help would appreciated.



  • 2.  RE: VM Backup

    Posted Jul 06, 2011 08:52 AM

    You will not be able to SCP the VMDK while the VM is powered on. Reason being that the file will be "locked".

    Judging by your requirements of no downtime and the fact that you have no real backup software installed, I think your best bet would be to use VMware Converter to create a new VM containing the same data and information.

    This would probably be your best option, that is if your VM is that of a supported operating system. Check out the following points of information:

    https://www.vmware.com/pdf/convsa_43_guide.pdf = Users Guide

    http://downloads.vmware.com/d/info/datacenter_downloads/vmware_vcenter_converter_standalone/4_0 = Product download page

    http://www.vmware.com/products/converter/ = Product Overview page

    http://youtu.be/q5PvytYblQ0 = Best Practices video on our KBTV channel



  • 3.  RE: VM Backup

    Posted Jul 06, 2011 09:30 AM

    to my bad luck...I dont even hav enough storage. VM is of 160GB..i have only 40GM freespace in storage.



  • 4.  RE: VM Backup

    Posted Jul 06, 2011 09:37 AM

    Is the operating system of the VM actually consuming all 160 GB of the VMDK?

    If not, then you can use VMware Converter to "resize" the new VM which it will create.

    For example, if your original VM consists of a 160 GB VMDK, but you are actually only using 100 GB of that VMDK, then Converter will be able to simply copy the used 100 GB of used space into a new VM with a VMDK of 100 GB.

    This would only be possible if the VM was running a Windows OS though as it will not work so well with Linux.



  • 5.  RE: VM Backup

    Posted Jul 06, 2011 10:34 AM

    1. Take the snapshot of VM.

    2.Backup the Original VMDK file.

    3.Remove the snapshot after vmdk file backed up.

    You can use below powershell script to backup the vmdk file in your  local system drive and you can also fixed the size of datastore( if datastore size is equal to 40GB then take the snapshot and backup the VMDK file otherwise exit) if  datastore size is equal to your mentioned size then it will take the snapshot, backup the vmdk file and remove the snapshot. you have to mention size in MB in script.

    To run the script first fixed the size and then run with vmware powershell.

    ex.- ./test.ps1 "Test" where "Test" is your VM Name.

    param([string] $vc)
    $size= "27189"
    $bpath="d:\MyBackupFolderForVMs\"
    $dc=Get-Datastore -VM $vc
    foreach($ds in $dc)
    {
    if ($_FreeSpaceMB -le $size)
    {
    Write-Host -ForegroundColor Green "Enough space Available on the datastore" $dc
    Write-Host  "Please wait Creating Snapshot"
    new-Snapshot -VM $vc -Name Backup
    Write-Host  "Snapshot has been created"
    Write-Host "Mapping Datastore As a Local Drive"
    $datastore = Get-Datastore $dc
    New-PSDrive -Location $datastore -Name ds -PSProvider VimDatastore -Root "\"
    Set-Location ds:\
    Write-Host  "Copying VMDK files to " $bpath
    Copy-DatastoreItem -Item ds:\$vc\$vc.vmdk -Destination $bpath
    Write-Host  "Vmdk files copied successfully to" $bpath
    Write-Host  "Removing Snapshot"
    Get-Snapshot -VM $vc | Remove-Snapshot -Confirm:$false
    Set-Location G:\
    Write-Host -ForegroundColor Yellow $vc "vmdk file has been saved to" $bpath "and Ready for backup"
    }
    else
    {
    Write-Host -ForegroundColor Red "No Enough Space Available on the" $dc "datastore can't create snapshot"
    }
    }



  • 6.  RE: VM Backup

    Posted Jul 06, 2011 08:58 AM

    Hi,

    If you're using vSphere, u can use VMware Data Recovery to backup your vms

    check: http://www.vmware.com/products/data-recovery/overview.html