Amanda server is running FreeBSD, the syntax bellow depends on FreeBSD.
# NFS for VMware back-up nfs_server_enable="YES" nfs_server_flags="-u -t" rpcbind_enable="YES" rpc_lockd_enable="YES" rpc_statd_enable="YES"in /etc/exports; we will use the directory /virtual for temporary back-up of VMware virtual machines:
/virtual -maproot=0:0 virtual1000.cs.ait.ac.th virtual2000.cs.ait.ac.th virtual3000.cs.ait.ac.th virtual4000.cs.ait.ac.th virtual5000.cs.ait.ac.thin /etc/hosts.allow (this may be overkill, IP depends on CSIM network):
# Rpcbind is used for all RPC services; protect your NFS! # (IP addresses rather than hostnames *MUST* be used here) rpcbind : 192.41.170.0/255.255.255.0 : allow rpcbind : 10.41.170.0/255.255.255.0 : allow rpcbind : ALL : deny # Rquota used by NFS rpc.rquotad: 192.41.170.0/255.255.255.0 : allow rpc.rquotad: 10.41.170.0/255.255.255.0 : allow rpc.rquotad: ALL : deny # Portmapper is used for all RPC services; protect your NFS! # (IP addresses rather than hostnames *MUST* be used here) portmap : 192.41.170.0/255.255.255.0 : allow portmap : 10.41.170.0/255.255.255.0 : allow portmap : ALL : deny
Cmnd_Alias AMANDA = /bin/rm amanda ALL=(root) NOPASSWD: AMANDA
Edit the script to reflect the list of ESXi servers.
define script vmware { plugin "vmware" execute-where server execute-on pre-dle-backup, post-dle-backup } define dumptype vmware { comment "Full dump of VMware virtual machine snapshot" auth "bsd" index yes compress server best estimate server priority high program "GNUTAR" allow-split true skip-incr script "vmware" }Obviously, incremental dumps make no sens here.
amanda /virtual/mybackups/Desktop\ Olivier vmware 1 diskghettoVCB adds the subdirectory mybackups in /virtual; that can be changed in the configuration of ghettoVCB.
When a VMWare server reboots, the file systems are re-generated from some back-up/master copies. Anything installed elsewhere than the datastores is lost. For this script to work, you must have a datastore named datastore1.The configuration file ghettoVCB.conf must contain:
VM_BACKUP_VOLUME="/vmfs/volumes/Oak (NFS) private network/mybackups" DISK_BACKUP_FORMAT=thin VM_BACKUP_ROTATION_COUNT=3 POWER_VM_DOWN_BEFORE_BACKUP=0 ENABLE_HARD_POWER_OFF=0 ITER_TO_WAIT_SHUTDOWN=3 POWER_DOWN_TIMEOUT=5 ENABLE_COMPRESSION=0 VM_SNAPSHOT_MEMORY=0 VM_SNAPSHOT_QUIESCE=0 ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP=0 ENABLE_NON_PERSISTENT_NFS=1 UNMOUNT_NFS=1 NFS_SERVER=amanda1000.cs.ait.ac.th NFS_VERSION=nfs NFS_MOUNT=/virtual NFS_LOCAL_NAME=nfs_temp_amanda NFS_VM_BACKUP_DIR=mybackups SNAPSHOT_TIMEOUT=15 WORKDIR_DEBUG=0 VM_SHUTDOWN_ORDER= VM_STARTUP_ORDER=Note that all the paths reflect the paths coded in the script.
vim-cmd hostsvc/datastore/nas_create mybackup 3 <mounted_directory> 0 amanda1000.cs.ait.ac.th
#"<DIRECTORY or .TGZ>;<DATASTORE_TO_RESTORE_TO>;<DISK_FORMAT_TO_RESTORE>" # DISK_FORMATS # 1 = zeroedthick # 2 = 2gbsparse # 3 = thin # 4 = eagerzeroedthick "/vmfs/volumes/oak1000/mybackups/DNS/DNS-2014-09-15_06-34-31;/vmfs/volumes/datas
/vmfs/volumes/datastore1/ghettoVCB-restore.sh -c <configuration-file> [-d 2]The option -d 2 is for debug.
vim-cmd hostsvc/datastore/destroy mybackup
This back-up is done before a user account is deleted. The result is stores in the file VMware-snapshot.<timestamp> in the home directory of the user.
It uses the script /home/java/on/Ldap/back-vmmachine; this script accepts one pool name as argument, the pool name must start with the account name of the user that will be deleted; for example, for the user st101876, all pool with a name staring with st101876 will be deleted, and the virtual machines in these pools will be deleted too.
The script is in ~on/Ldap/backup_vmmachine and is called by the job removing user accounts. For the moment, the script is limited to call virtual3 but can be extended to call the other virtual servers.
The installation of the public key and ghettoVCB is the same as above; the major difference is in the configuration file for ghettoVCB.
POWER_VM_DOWN_BEFORE_BACKUP=1 ENABLE_HARD_POWER_OFF=1
ENABLE_NON_PERSISTENT_NFS=1 UNMOUNT_NFS=1 NFS_SERVER=oak1000.cs.ait.ac.th NFS_VERSION=nfs NFS_MOUNT=/home/home/virtual NFS_LOCAL_NAME=nfs_temp_delete NFS_VM_BACKUP_DIR=mydeleteMake sure that the NFS_LOCAL_NAME does not conflict with the name of any datastore on the server.
VM_BACKUP_VOLUME="/vmfs/volumes/<Whatever existing datastore name>" ... ENABLE_NON_PERSISTENT_NFS=0