At first glance, using rsync for VMware backups seems elegant:
# Basic rsync example for VM backup
vim-cmd vmsvc/snapshot.create [vmid] "Backup Snapshot" "Pre-rsync backup" 1 1
rsync -avz --progress /vmfs/volumes/datastore1/VMNAME/ backup-server:/vm-backups/
vim-cmd vmsvc/snapshot.remove [vmid] [snapshot-id]
This approach works for small-scale environments, but breaks down in enterprise scenarios for several technical reasons.
1. Snapshot Chain Management:
VMware snapshots aren't designed for frequent backup operations. Each snapshot creates delta disks that impact performance. Professional backup solutions handle this through:
# Enterprise backup tools typically:
1. Create temporary snapshot
2. Use Changed Block Tracking (CBT)
3. Immediately commit snapshot
4. Transfer only changed blocks
2. Application Consistency:
While you can use the quiesce flag (vim-cmd vmsvc/snapshot.create [vmid] "" 1 1
), this only works for VMware Tools-aware applications. Enterprise backup solutions integrate with:
- SQL Server VSS writers
- Exchange database awareness
- Active Directory transaction logs
Rsync transfers entire files when inodes change, while professional solutions leverage VMware's Changed Block Tracking (CBT):
# Sample CBT query (requires proper authentication)
vim-cmd vmsvc/get.cbt [vmid]
Enterprise backup products can achieve 90%+ reduction in backup size through CBT-aware transfers.
An rsync-based solution lacks:
Feature | Enterprise Solution | Rsync Approach |
---|---|---|
Backup Verification | Automated checksum validation | Manual verification required |
Restore Granularity | File-level from image backup | Full VM restore only |
Storage Integration | Direct SAN access | Network-only transfer |
For small, non-critical Linux VMs with these characteristics:
# Example rsync backup script with basic safety checks
#!/bin/bash
VMID=$(vim-cmd vmsvc/getallvms | grep "MyVM" | awk '{print $1}')
SNAP_ID=$(vim-cmd vmsvc/snapshot.create $VMID "Backup $(date +%Y-%m-%d)" "" 1 1 | grep -oP '(?<=Snapshot).*?(?=created)')
rsync --rsync-path="sudo rsync" \
-avz --del \
--exclude='*.log' \
--exclude='*.tmp' \
/vmfs/volumes/datastore1/VMNAME/ \
backupuser@backupserver:/vm-backups/
vim-cmd vmsvc/snapshot.remove $VMID $SNAP_ID
Even in these cases, consider adding at least:
- Email notifications on failure
- Log rotation for the script output
- Pre-backup disk space checks
While your proposed rsync method works technically, enterprise environments face challenges that raw rsync can't address:
# Example rsync command you might use:
rsync -azP --delete /vmfs/volumes/datastore1/VM_NAME/ backup-server:/backups/VM_NAME/
1. Crash-Consistent vs Application-Consistent Backups
Snapshot quiescing only ensures filesystem consistency, not application consistency. Enterprise backup solutions integrate with VSS (Windows) or fs-freeze (Linux) for true application-consistent backups.
# Example of proper quiescing sequence:
vim-cmd vmsvc/snapshot.create [vmid] "Backup Snapshot" 1 1 0
# ...rsync operations...
vim-cmd vmsvc/snapshot.remove [vmid] [snapshotid]
2. Storage System Complexity
Modern VM environments use:
- VMFS-6/NFSv4.1 datastores
- vSAN storage policies
- RDMs and VVOLs
Feature | rsync | Veeam/Nakivo |
---|---|---|
CBT Support | No | Yes |
Instant Recovery | No | Yes |
Storage Integration | Basic | API-level |
For small-scale, non-critical Linux VMs with:
#!/bin/bash
# Simple backup script example
VMID=$(vim-cmd vmsvc/getallvms | grep "MyVM" | awk '{print $1}')
SNAPID=$(vim-cmd vmsvc/snapshot.create $VMID "Backup $(date +%F)" \
"Backup" 1 1 0 | awk '{print $NF}')
rsync -azP --delete /vmfs/volumes/datastore1/MyVM/ backup01:/backups/MyVM/
vim-cmd vmsvc/snapshot.remove $VMID $SNAPID
For those wanting simple solutions:
- VMware's native
vSphere Data Protection
- Open-source
Bacula
with VMware plugin Restic
with vSphere API integration