Backup Method One: Traditional Methods
Test Description: A few days ago, I tested two simple methods:
1. SSH into ESX and copy the entire VM directory (Windows 2003)
Test result: When the VM is running, the copied backup fails to start and throws an error. When the VM is stopped, the copied backup starts normally after being uploaded back.
2. Use the DataStorage Browser in VIC to download and upload
Issues: It’s uncertain if this method supports all backups.
Drawbacks: It only supports cold backups, requires a long time (40GB takes almost six hours), and the machine needs to be shut down during the process.
Backup Method Two: Using vcbMounter and vcbRestore
Introduction: Using vcbMounter for backup and vcbRestore for recovery supports hot backups. VMware Consolidated Backup is a new backup tool introduced by VMware for VMware Virtual Infrastructure.
Test Steps:
Backup
On Windows 2003:
Download and install VCB.
Execute the following command for backup:
vcbMounter -h esxhost -u backupuser -p password -a ipaddr:192.168.10.1 -r E:\vm-backups\vm1
Parameters:
-h: Specify the ESX HOST or VIRTUAL CENTER executing the command.
-u: Account for executing the command.
-p: Password for the account.
-a: Specify the VM to backup, can use IP, FQDN, VM name, etc.
-r: Directory to store the backup IMAGE. Can be on local or shared storage.
-M 1: Do not split.
-F 1: Do not compress.
Since SAN support might be needed under Windows, errors occurred during the backup process. Currently, there is no SAN environment.
Using Service Console on ESX:
Parameters are the same as on Windows:
vcbMounter -a ipaddr:192.168.10.1 -r /vmfs/volumes/DataStorage1/vm-backups/vm1
Backup succeeded. Note: After backup and restore, snapshots were lost, possibly due to default compression during backup.
Restore
Use the following command for restore:
vcbRestore -s /vmfs/volumes/DataStorage1/vm-backups/vm1 -b overwrite
Without the -b overwrite parameter, it will prompt whether to overwrite. Restoring a system of about 25GB took approximately 25 minutes.
Issues:
Restoration defaults to the original directory. If the backup is transferred to another ESX, the directory structure might be different.
Solution (untested):
Modify the ServerName and storagename in the Catalog file. Some have tested this successfully.
Backup to Remote Directory on ESX
Backup via SMB to Windows
Steps:
1. Open the firewall
chkconfig iptables on # Effective after reboot service iptables start # Effective immediately
2. Edit the /etc/hosts file to give a name to the Windows server.
3. Connect to the Windows shared directory:
Temporary mapping:
mkdir /mnt/software mount -t smbfs -o codepage=936,iocharset=cp936,username=dgsheng,password=123456 //dgsheng/share /mnt/ntserver
Permanent mapping:
Edit the /etc/fstab file, adding a line:
banana/share /mnt/ntserver smbfs codepage=936,iocharset=cp936,username=dgsheng,password=123456 0 0
Note: Use smbClient to test the connection to the Windows share:
smbclient -L //ip -U dgsheng
Backup
Use vcbMounter to backup to the remote directory
vcbMounter -h host -u username -p password -a ipaddr:192.168.10.101 -r /mnt/ntserver
Conclusion
Traditional methods are simple but limited to cold backups. Using vcbMounter and vcbRestore supports hot backups and offers greater reliability and flexibility for VMware environments.