Created
February 25, 2013 15:59
-
-
Save cobracmder/5030811 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
DATE=`date +%F` | |
# | |
# Create Backup Directory | |
# | |
DIR_NAME="$DATE""_VM_BACKUP" | |
mkdir $DIR_NAME | |
cd /opt/backup/$DIR_NAME | |
# | |
# Cleanup all previous snapshots | |
# | |
zfs destroy zones/a209c882-99d8-49d0-8e5e-fbebaad8ffd3@vpn-server | |
zfs destroy zones/a209c882-99d8-49d0-8e5e-fbebaad8ffd3-disk0@vpn-server-disk0 | |
zfs destroy zones/a98ce475-d447-4e49-81b7-2cb266599ebd@dns-server | |
zfs destroy zones/e8d4bc10-2ebd-4921-803c-db27847d76c2@svn-server | |
# | |
# Take snapshots of each of the virtual machines | |
# | |
zfs snapshot zones/a209c882-99d8-49d0-8e5e-fbebaad8ffd3@vpn-server | |
zfs snapshot zones/a209c882-99d8-49d0-8e5e-fbebaad8ffd3-disk0@vpn-server-disk0 | |
zfs snapshot zones/a98ce475-d447-4e49-81b7-2cb266599ebd@dns-server | |
zfs snapshot zones/e8d4bc10-2ebd-4921-803c-db27847d76c2@svn-server | |
# | |
# Now save the snapshots in a file to be backed up | |
# | |
zfs send -v zones/a209c882-99d8-49d0-8e5e-fbebaad8ffd3@vpn-server > vpn-server_snapshot_$DATE | |
zfs send -v zones/a209c882-99d8-49d0-8e5e-fbebaad8ffd3-disk0@vpn-server-disk0 > vpn-server-disk0_snapshot_$DATE | |
zfs send -v zones/a98ce475-d447-4e49-81b7-2cb266599ebd@dns-server > dns-server_snapshot_$DATE | |
zfs send -v zones/e8d4bc10-2ebd-4921-803c-db27847d76c2@svn-server > svn-server_snapshot_$DATE | |
# | |
# Now save the Virtual machine startup XML files | |
# | |
cp /etc/zones/a209c882-99d8-49d0-8e5e-fbebaad8ffd3.xml . | |
cp /etc/zones/a98ce475-d447-4e49-81b7-2cb266599ebd.xml . | |
cp /etc/zones/e8d4bc10-2ebd-4921-803c-db27847d76c2.xml . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment