oshani
Contributor
Contributor

Using Vsphere scheduled tasks to backup vms

Hi All,

I am trying to use the Vsphere scheduled clones to backup vms. The problem is that after 1 successful run, the clone fails because the target machine already exists.

So first of all, did I miss something and there is a way to tell the scheduler to number or date-postifx the target vms, or something like that?

Secondly, assuming the above is not possible, I need some help with the workaround that I am trying to implement, which is simply to use a script on the NFS server that I clone the machines on, to copy or move he vm's directory and then tell the Esxi host to delete the machine, by executing the vim-cmd destroy command via ssh. The problem is , that when I do that, the vm is not removed in the Vcenter , but appears as orphaned. I guess this is because I run the destroy command directly to the vmhost and not via the vcenter, but I can't find my arms and legs in the vcenter cli.

So if someone could be so kind and share some reasonable way to solve this problem, I'd appreciate it. I'm sure I am not the only one who encountered it, I mean, you all do backups, right?

Many thanks in advance,

Oren

5 Replies
timweaver23
Enthusiast
Enthusiast

Hi,

  1. In VC select home -> Customization Specification Manager
  2. Select new
  3. Go through the steps until you get to the section to Enter a name
  4. Enter the name and select the option to append a numeric value to ensure uniqueness (This will add a number on the end of each clone that is created)
  5. Continue through the customization settings and save it
  6. Setup your scheduled clone
  7. When you get to the Guest Customization step select Customize using an existing customization specification
  8. Select the customization you saved above.

You could also use the option customize using the customization wizard on the individual clone jobs and use step 4 above to make the clone unique.

Cheers

0 Kudos
oshani
Contributor
Contributor

@timweaver23, thank you, but doesn't this option just change the hostname in the guest OS? What I would like to do, is to change the name it appears by to the VMware host/vcenter

Oren

0 Kudos
timweaver23
Enthusiast
Enthusiast

Its been a long time but as far as I remember it creates a clone with a unique name in both

0 Kudos
oshani
Contributor
Contributor

I checked that. This option only affects the guest name internally, not the vm name in the host.

Thank you anyway,

Oren

Dee006
Hot Shot
Hot Shot

Oren,

Do you want to save the file with same name?If yes it is not possible to register in the inventory with same name,Alternatively you can create a VM lets say VM20112016 and next day as VM21112016 for clone.If prefer to go automation using powercli,make sure that you have enough space in the datastore.

http://blogs.vmware.com/PowerCLI/2015/08/using-vmware-instant-clone-via-powercli-extensions-fling.ht...

0 Kudos