Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
vmware [2008/09/26 20:13]
a
vmware [2009/01/16 13:56]
cyc
Line 2: Line 2:
  
 [[:vmware:workstation]] [[:vmware:workstation]]
 +
  
 ===== Fixing time-management in vm-instances on VMware ===== ===== Fixing time-management in vm-instances on VMware =====
Line 14: Line 15:
  
 <note important>Do **NOT** run any other timekeepers in the guest operating system! (like the **W32Time** service on windows and the **NTP** daemon on UNIX systems). Read [[http://www.vmware.com/pdf/vmware_timekeeping.pdf|this pdf]] (written by VMware) for more details and background information.</note> <note important>Do **NOT** run any other timekeepers in the guest operating system! (like the **W32Time** service on windows and the **NTP** daemon on UNIX systems). Read [[http://www.vmware.com/pdf/vmware_timekeeping.pdf|this pdf]] (written by VMware) for more details and background information.</note>
 +
 +
 +
 +
 +
 +===== Backing up virtual machines on VMware Server 2.0 =====
 +
 +Because WMware's backup of running virtual machines is still in experimental stage, you have to shut down the virtual machines and then copy files from the datastore. That is - if you you want to avoid using that experimental feature.
 +
 +You can create a user on a virtual machine and grant permission to shut down via sudo:
 +  * ''sudo adduser username admin'' enables user username to run sudo
 +  * add ''username hostname = NOPASSWD: /sbin/shutdown'' to /etc/sudoers
 +  * Create a script, that will shut down virtual machines, check with ping after one minute if it is really shut down and then copy VM's files from datastore to TARGET location and after finishing that, power virtual machine back on. Of course you run it on your VMware Server host - where you have the datastore.
 +
 +Here is an example of the script. You will have to modify at least usernames and paths, maybe more, but it will give you an idea of how it can be done.
 +
 +<code bash>
 +#!/bin/bash
 +#
 +# Backup virtual machines
 +#
 +# In file /home/user/vm_hostnames define hosts of virtual machines (as they appear in VMware Server).
 +# DNS records for the same names must exist too!
 +#
 +TARGET=/mnt/backup
 +#
 +for VM in `cat /home/user/vm_hostnames`
 +do
 + ssh username@${VM} sudo /sbin/shutdown -h now
 + sleep 60
 + ping -c 2 ${VM}
 + TARGET_PATH=${TARGET}/${VM}.`/bin/date +%Y%m%d`
 + mkdir $TARGET_PATH
 + if [ $? -eq 1 ]
 + then
 + cp /vm/Virtual\ Machines/${VM}/* ${TARGET_PATH}/
 + /usr/local/vmware-server/bin/vmrun -T server -h https://VM_HOST_IP:8333/sdk -u vmuser -p vmpass start "[standard] ${VM}/${VM}.vmx"
 + else
 + echo Host $VM not shut down yet! >> /home/user/vm_backup.err
 + fi
 +done
 +</code>
 +
 +''vmuser'' and ''vmpass'' are username and password you use to login to VMware Server console. ''VM_HOST_IP'' is the IP of your VMware Server host. The file ''vm_hostnames'' in the script is a list of hostnames of virtual machines you wish to back up.
 +
vmware.txt ยท Last modified: 2009/12/14 23:39 by 193.164.137.40
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready