LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 09-24-2015, 10:14 AM   #1
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Rep: Reputation: Disabled
esxi 6 - schedule task


hi all,

want to know if theres a way to create a scheduled task for esxi 6 or if i can ssh into the esxi host and create a cronjob

basically i want it to make a scheduled task so it can clone a vm, i know the free esxi cannot do a clone of a vm but i have found a way of doing this -

make sure you poweroff the vm first before proceeding

browse a datastore > create a folder under root > "server with a suffix of clone"

on the live server you just poweredoff copy the "vmx" and the "vmdk" files ie the virtual machine and the virtual disk and paste it in the folder you created

open up the new folder > right click "vmx" > add to inventory

power on the vm (if you get a notice just say "already copied it")

boom, job done

now is there anyway to automate this and make a schedule for it

many thanks

rob
 
Old 09-25-2015, 03:46 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
I think you should regard your VMWare ESXi server as something that you should not want to tarnish / pollute / potentially b0rk with non-VMWare custom modifications but use the VIX API to remotely "drive" ops?..
 
Old 09-25-2015, 04:52 AM   #3
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
job done

make sure vm tools are installed on all your guests before you continue, otherwise you cant shutdown and power on your guests via cmd

-

vim-cmd vmsvc/power.shutdown 22

sleep 20

mkdir /vmfs/volumes/datastore1/guacamole_clone

vmkfstools -i /vmfs/volumes/datastore1/guacamole/guacamole.vmdk /vmfs/volumes/datastore1/guacamole_clone/guacamole.vmdk

cp /vmfs/volumes/datastore1/guacamole/guacamole.vmx /vmfs/volumes/datastore1/guacamole_clone

vim-cmd solo/registervm /vmfs/volumes/datastore1/guacamole_clone/guacamole.vmx

vim-cmd vmsvc/power.on 22

-

i changed it abit, i had to put in a sleep command as the guest was still shutting down and it locked the vmdk file and it failed

Last edited by robertkwild; 09-25-2015 at 12:07 PM.
 
Old 09-28-2015, 10:31 AM   #4
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
obviously you cant create a clone of a live vm as it gives an error saying cant copy vmdk as it is locked and the cloning process just doesnt work

you can however create snapshots of vms while in a live state, if i created a snapshot of my live vm can i copy that snapshot to my clone vm?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Schedule a task in RHEL? Raju Roy Linux - Server 7 09-19-2011 09:42 AM
How to schedule for a repeated task? hadimotamedi Linux - Newbie 7 05-04-2010 02:58 AM
shut down time in schedule task fa_khan50 Linux - Server 3 02-08-2008 11:09 AM
How to schedule *interactive* task with at or cron fast_rizwaan Linux - Newbie 4 09-09-2005 06:26 PM
Schedule a task ! L1nuxbug Linux - Networking 4 03-02-2005 07:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 08:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration