Um beim ESX Server die Gastbetriebssysteme ohne einen suspend hot backup sichern zu können, hat Massimiliano Daneri das vmbk.pl Skript entwickelt. Das Skript verwendet die Funktionen des ESX-Servers um eine REDO-LOG Disk zu erstellen, so dass ein backup der gesamten Disk mittels des vmfstools Befehls ermöglicht wird.
TSM (Tivoli Storage Manager) für Backup und Restore von VMware Virtual Disk Files: Online Resource (PDF, 560K)
Für die Installation benötigt man rh7 Mime::Lite rpm,local copy und
ESX Backup Skript vmbk.pl Homepage local copy (68K)
Die Konfiguration wird sowohl über die .vmx-Dateien als auch die vmbk.conf Datei gesteuert.
.vmx-Optionen
BACKUP = NONE | MANUAL | AUTO | ALWAYS NONE : this guest never will be backup MANUAL : this guest will be backup only when vmbk.pl has been executed in interactive mode AUTO : normal way (default) ALWAYS : backup always this guest, even if you do not explicit it BACKUP.MODE = REDO | SUSPEND | STOP | SOFTSTOP | SOFTSUSPEND | REDOREDO REDO : Normal mode SUSPEND : Suspend guest before do a backup STOP : Stop the guest before do a backup SOFTSTOP : Stop the guest before do a backup try only a software shutdown SOFTSUSPEND : Suspend the guest before do a backup run a script on guest REDOREDO : Add a double level Redo Info SCSIX:Y.BACKUP = NONE | MANUAL | AUTO where X: guest scsi controller and Y: guest id disk NONE : this scsi disk never will be backup MANUAL : this scsi disk will be backup only when vmbk.pl has been executed in interactive mode AUTO : normal way (default) BACKUP.SESSION = 'name of session' this guest will be backup only when vmbk.pl has been executed with -b parameters with the same 'name of session'
Mounten des Samba-Shares: mount -t smbfs -o username=thomasba \\tirinas01\vmtmp /mnt/vmtmp
time vmbk.pl -d /mnt/vmtmp/ -4 -v 1 -l /var/log/vmbk.log
vmbk.pl Version 2.22.2 rev.1
Massimiliano Daneri
for support send email to
support@vmts.net
Process started on HOST tiriesx01
Date : 16:05:2006
Time : 14:51:04
Connection to Server local [ OK ]
Enumerating Guest on Server local [ OK ]
Check space on destination directory:
/mnt/vmtmp/ [//tirinas01/vmtmp]
538476544 MByte Free [ OK ]
Start Time : 14:51:4
################################################################################
Virtual Machine Name : TIRIVM004 - RHEL4 U3 Server
################################################################################
Power Status *Powered On - Running*
Connecting to Guest with config file /home/thomasba/tirivm004/linux.vmx
Check space on destination directory:
/mnt/vmtmp/ [//tirinas01/vmtmp]
538476544 MByte Free [ OK ]
Enumerating SCSI Disk [ OK ]
VMDisk scsi0:0 : TIRIVM004.vmdk
Check space for REDO LOG:
vmhba2:0:0:1 [ storage ]
102534 MByte Free [ OK ]
Test guest's status [ OK ]
Add REDO log file [ OK ]
Test guest's status [ OK ]
Starting backup on directory
/mnt/vmtmp/vm-TIRIVM004 - RHEL4 U3 Server/
using /usr/sbin/vmkfstools -e
Status Backup [ OK ]
Backup Configuration files :
Copy config file [ OK ]
Copy NVRAM file [ OK ]
Commit REDO log file [ OK ]
Test guest's status [ OK ]
Close guest connection [ OK ]
End time : 15:24:48 (2024s)
Disconnected from Serverlocal [ OK ]
Flushing data.......................................................... [ OK ]
Process Finished
Date : 16/05/2006
real 34m0.552s
user 0m19.170s
sys 1m12.870s
time vmbk.pl -d /vmfs/vmhba2\:0\:0\:1/ -V -R -m -4 -v 1 -l /var/log/vmbk.log
# erstellt unter /vmfs/vmhba2:0:0:1 eine Datei namens vm-{diskname}.vmdk (dauer - ca 20min)
vmbk.pl Version 2.22.2 rev.1
Massimiliano Daneri
for support send email to
support@vmts.net
Process started on HOST tiriesx01
Date : 16:05:2006
Time : 16:02:29
Connection to Server local [ OK ]
Enumerating Guest on Server local [ OK ]
Check space on destination directory:
/vmfs/vmhba2:0:0:1/ [-]
1024000000 MByte Free [ OK ]
Flat Mode Enable [ OK ]
You are using a VMFS partition [ OK ]
Start Time : 16:2:29
################################################################################
Virtual Machine Name : TIRIVM004 - Phoenix Abnhame Applikationsserver
################################################################################
Power Status *Powered On - Running*
Connecting to Guest with config file /home/thomasba/tirivm004/linux.vmx
Check space on destination directory:
/vmfs/vmhba2:0:0:1/ [-]
1024000000 MByte Free [ OK ]
Enumerating SCSI Disk [ OK ]
VMDisk scsi0:0 : TIRIVM004.vmdk
Check space for REDO LOG:
vmhba2:0:0:1 [ storage ]
102534 MByte Free [ OK ]
Test guest's status [ OK ]
Add REDO log file [ OK ]
Test guest's status [ OK ]
Starting backup on directory
/vmfs/vmhba2:0:0:1/
using /usr/sbin/vmkfstools -d
Status Backup [ OK ]
Backup Configuration files :
Copy config file [ OK ]
Copy NVRAM file [ OK ]
Commit REDO log file [ OK ]
Test guest's status [ OK ]
Close guest connection [ OK ]
End time : 16:14:25 (716s)
Disconnected from Serverlocal [ OK ]
Flushing data.......................................................... [ OK ]
Process Finished
Date : 16/05/2006
real 12m11.982s
user 0m0.250s
sys 1m38.380s
examples
vmbk.pl -d /export/ Backup vm started to /export/ directory vmbk.pl -d /export/ -a -1 Backup ALL vm to /export/ directory with vmdk extension vmbk.pl -d /export/ -i Show menu where you may chose which guest backup vmbk.pl -d /tmp/ -f ftp=ftpserver,dir=/vmbackup,user=ftpuser,password=ftppassword,passive=false Backup VM to ftpserver with ftp protocol(passive mode), using /tmp/ directory for temporary file vmbk.pl -d /vmbk/ -s smb=//smbserver/share,user=smbuser,password=smbpassword Backup VM to smbserver mounting //smbserver/share on /vmbk/ vmbk.pl -d /vmbk/backup -s smb=//smbserver/share,user=smbuser,password=smbpassword,mountpoint=/vmbk Backup VM to smbserver mounting //smbserver/share on /vmbk/ and export to /vmbk/backup vmbk.pl -d /vmbk/ -s smb=//smbserver/share,user=smbuser,password=smbpassword -e smtp=smtpserver,from=esx@vmts.net,to=support@vmts.net Backup VM to smbserver mounting //smbserver/share on /vmbk/ and send a report by email vmbk.pl -d /export/ -n srvnfs:/exp -a Backup ALL vm to exp on server 'srvnfs' vmbk.pl -d /export/vmbk/backup -n nfs=srvnfs:/exp,mountpoint=/export -a Backup ALL vm to exp on server 'srvnfs' under /export/vmbk/backup mounting srvnfs:/exp on /export dir vmbk.pl -d /export/ -l /var/logfile.log Backup all vm switched on to /export/ directory and send output to log file '/var/logfile.log' vmbk.pl -d /export/ -l /var/logfile.log -v 2,3,7 Backup vm number 2,3,7 to /export/ directory and send output to log file '/var/logfile.log' vmbk.pl -d /export/ -L /var/logfile.htm -b DataServers Backup vm with configured 'BACKUP.SESSION = "DataServers"' to /export/ directory and send output to log file '/var/logfile.htm' (html mode) vmbk.pl -L /var/logfile.htm -b DataServers -B policy=VMwarePolicy Backup vm with configured 'BACKUP.SESSION = "DataServers"' to Netbackup master server using VMwarePolicy policy and send output to log file '/var/logfile.htm' (html mode) vmbk.pl -l /var/vmbk -b DataServers -G server=LegatoServer,group=VMWare Backup vm with configured 'BACKUP.SESSION = "DataServers"' to Legato Networker server "LegatoServer" using VMware group and send output to log file '/var/vmbk' (text mode) vmbk.pl -d /vmbk/backup -s smb=//smbserver/share,user=smbuser,password=smbpassword,mountpoint=/vmbk -Q Backup VM to smbserver mounting //smbserver/share on /vmbk/ and export to /vmbk/backup using tar creating a tar file for each disk + configuration vmbk.pl -f ftp=ftpserver,dir='/',user=user,password=password,passive=false,timeout=100 -5 %none% -c -4 -m -q Backup VM to ftp server put all file (tar.gz format) on same ftp directory / , every file rappresent a VM with inside vmx file, disk , restore file the name of tar file is the same of guest (no prename) vmbk.pl -l /var/vmbk -b DataServers -B policy=VMwarePolicy -y Backup vm with configured 'BACKUP.SESSION = "DataServers"' to Netbackup master server using VMwarePolicy policy and send output to log file '/var/vmbk' plus write log also on syslog with facility 'local6' and level 'info'