OpenVZ Forum


Home » General » Support » Vzdump all container in backup hard disk
Vzdump all container in backup hard disk [message #49043] Sun, 03 March 2013 18:00 Go to next message
blackmetal is currently offline  blackmetal
Messages: 5
Registered: January 2012
Junior Member
Hello
I have 2 hard drive my first hard drive have os,vz,container and etc and my second drive mount on /backup i want backup all of my container in same node in /backup which is my second hard disk how can i give backup path to vzdump?
Thanks
Re: Vzdump all container in backup hard disk [message #49044 is a reply to message #49043] Mon, 04 March 2013 07:56 Go to previous messageGo to next message
mangelot is currently offline  mangelot
Messages: 14
Registered: January 2012
Junior Member
see also:

openvz.org/Backup_of_a_running_container_with_vzdump

result: --dumpdir DIR store resulting files in DIR


nice script to use:

backup.sh

#!/bin/bash
# ve_dumps.sh
# Dump all VEs

# Todays' date
DATE=$(date +%d)

# Paths
BAK_PATH=/backup
# Week of month
BAK_DIR=$(cal | awk -v date="${DATE}" '{ for( i=1; i <= NF ; i++ ) if ($i==date) { print FNR-2 } }')

# Function to check and remove previously failed snapshot.
check_vzsnap() {
  OUTPUT=`/usr/sbin/lvdisplay | grep vzsnap`
  [ -n "$OUTPUT" ] && lvremove -f /dev/vg0/vzsnap
}

# Function to perform backup.
backup() {
  # Check and create the required backup directory
  [ -d "${BAK_PATH}/${BAK_DIR}" ] || mkdir -p ${BAK_PATH}/${BAK_DIR}
  # do dumps
  echo "Starting dump at `date`"
  /usr/bin/vzdump --exclude-path '.+/log/.+' --exclude-path '.+/bak/.+' --exclude-path '/tmp/.+' --exclude-path '/var/tmp/.+' --exclude-path '/var/run/.+pid' --snapshot --dumpdir=${BAK_PATH}/${BAK_DIR} --compress --all
  echo "Completed dump at `date`"
}

# Main ############################

# Remove previously failed snapshot
check_vzsnap

# Run backups
backup

exit 0


this wil backup all containers in /backup (BAK_PATH)

Drop the script in /etc/cron.weekly/ or add to crontab:

# weekly dump of VEs
21 1 * * sun /usr/local/bin/ve_dumps.sh


www.mangelot-hosting.nl
Re: Vzdump all container in backup hard disk [message #49046 is a reply to message #49043] Mon, 04 March 2013 10:26 Go to previous message
blackmetal is currently offline  blackmetal
Messages: 5
Registered: January 2012
Junior Member
just a question in # Function to check and remove previously failed snapshot. it check lvm i do not use lvm is it ok ?
i use ext4 and ext3
thanks,
Previous Topic: kernel crash
Next Topic: fork: Cannot allocate memory
Goto Forum:
  


Current Time: Fri Jul 26 21:25:39 GMT 2024

Total time taken to generate the page: 0.03473 seconds