...
Create a daily backup of the second virtual OS
Second phase: Configure CUPCAKE
Explanation of runscycle and other in amanda.conf
dumpcycle | runs per cycle | runtapes | tapecycle | tapetype | ||||
The amount of days you will have a full backup (ex: every 4 weeks = 28) | How many backup runs per dumpcycle (ex: every week = 4) | How many tapes to use per run (ex: Biggest disklist + a bit / tapetype size = 12) | How many tapes are available. The number decrease at every run. Runtapes * runs per cycle + a bit(ex: 50) | defines the size of a tape (ex: DVD size: 4,5G) | ||||
1 | ||||||||
2 | DLE_1 | 10G | ||||||
3 | DLE_2 | 45G | ||||||
4 | DLE_3 | 1G | ||||||
5 | ||||||||
6 | ||||||||
7 | run | 12 | ||||||
8 | ||||||||
9 | ||||||||
10 | ||||||||
11 | ||||||||
12 | ||||||||
13 | ||||||||
14 | run | 12 | ||||||
15 | ||||||||
16 | ||||||||
17 | ||||||||
18 | ||||||||
19 | ||||||||
20 | ||||||||
21 | run | 12 | ||||||
22 | ||||||||
23 | ||||||||
24 | ||||||||
25 | ||||||||
26 | ||||||||
27 | ||||||||
28 | dumpcycle | run | 12 |
Creating the script adapted to the present situation of the server (12/2011)
Code Block |
---|
#!/bin/bash ## this is to automate the amanda setup ## variables used. SERVICE=bluelight FREQ=-weekly # frequence of the backup MOUNTPOINT1=/media/backup-data # mountpoint for holding MOUNTPOINT2=/media/backup-data2 # mountpoint for backup TAPE=`echo ${SERVICE}${FREQ} | tr [a-z] [A-Z]` ## create the directory structure for the folders to keep the backup mkdir ${MOUNTPOINT1}/amanda ${MOUNTPOINT1}/amanda/holding ${MOUNTPOINT1}/amanda/holding/${SERVICE}${FREQ} chown backup.disk -R ${MOUNTPOINT2}/amanda/* chown backup.disk -R ${MOUNTPOINT1}/amanda/* ## create the config in /etc/amanda mkdir /etc/amanda/${SERVICE}${FREQ} touch /etc/amanda/${SERVICE}${FREQ}/amanda.conf touch /etc/amanda/${SERVICE}${FREQ}/disklist chown -R backup.backup /etc/amanda/${SERVICE}${FREQ} ## The config files cat << EOF > /etc/amanda/${SERVICE}${FREQ}/amanda.conf org "Bluelight" mailto "bluelight@auroville.org.in" dumpcycle 28 runspercycle 4 runtapes 15 tapecycle 60 dumpuser "backup" tpchanger "chg-disk" # a virtual tape changer tapedev "file:/media/backup-data2/amanda/vtapes/bluelight-weekly" changerfile "/var/lib/amanda/bluelight-weekly/changerfile" labelstr "BLUELIGHT-WEEKLY-.*" #label_new_tapes "BLUELIGHT-WEEKLY-%%" tapetype DVD_SIZED_DISK logdir "/var/lib/amanda/bluelight-weekly" infofile "/var/lib/amanda/bluelight-weekly/curinfo" indexdir "/var/lib/amanda/bluelight-weekly/index" tapelist "/var/lib/amanda/bluelight-weekly/tapelist" holdingdisk hd1 { directory "/media/backup-data/amanda/holding/bluelight-weekly" } define dumptype comp-tar { program "GNUTAR" compress fast index yes # record no # Important! avoid interfering with production runs } define dumptype user-tar-span { comp-tar tape_splitsize 445 MB holdingdisk no split_diskbuffer "/media/backup-data/amanda/holding/diskbuffer" fallback_splitsize 100M comment "tape-spanning user partitions dumped with tar" compress none } define dumptype user-tar-span-home { user-tar-span comment "exluding all the unwanted things from /home" exclude list "/etc/exclude-list" compress none } define tapetype DVD_SIZED_DISK { filemark 4 KB length 4482 MB } EOF ## create the disklist cat <<EOF > /etc/amanda/${SERVICE}${FREQ}/disklist rose.bluelight.av /etc user-tar-span rose.bluelight.av /root user-tar-span rose.bluelight.av /var user-tar-span #192.168.10.12 /home/aufilduweb/data/Entreprises/Auroville/ user-tar-span # #192.168.10.12 /var/www/./programming /var/www { # user-tar-span ## auth "bsdtcp" # include "./meeting" # include "./act" # include "./mm_visitor_access" #} 2 #this section is for everything in /home ###### rose.bluelight.av /home/./bharathy /home/ { user-tar-span-home include "./bharathy" } 1 rose.bluelight.av /home/./juergen /home/ { user-tar-span-home include "./juergen" } 1 rose.bluelight.av /home/./resources /home/ { user-tar-span-home include "./resources" } 1 rose.bluelight.av /home/./rest /home/ { user-tar-span-home exclude append "./bharathy" exclude append "./juergen" exclude append "./resources" exclude append "./backup" exclude append "./backup_services" exclude append "./rdiff-backup" exclude append "./classes" exclude append "./joy" exclude append "./sincerity" exclude append "./surrender" exclude append "./music" } 1 ###### EOF ## as the backup user create all the virtual tapes and label them su backup -c "mkdir ${MOUNTPOINT2}/amanda/vtapes/${SERVICE}${FREQ}" for i in `seq 30`; do su backup -c "mkdir ${MOUNTPOINT2}/amanda/vtapes/${SERVICE}${FREQ}/slot$i"; done cd ${MOUNTPOINT2}/amanda/vtapes/${SERVICE}${FREQ} && ln -s slot1 data ## create the tapelist su backup -c "mkdir /var/lib/amanda/${SERVICE}${FREQ}" su backup -c "touch /var/lib/amanda/${SERVICE}${FREQ}/tapelist" ## label the tapes for i in `seq 30`; do su backup -c "/usr/sbin/amlabel ${SERVICE}${FREQ} ${TAPE}-$i slot $i"; done [ -d /root/scripts ] || mkdir /root/scripts ## create the starting script cat <<EOF > /root/scripts/amanda-${SERVICE}${FREQ}-backup #!/bin/bash su backup -c "/usr/sbin/amdump ${SERVICE}${FREQ}" sleep 20 # if the machine should stay on after the backup create a file in / called no # ie touch /no if [ -f /no ] then rm -f /no exit 0 else /sbin/halt fi exit 0 EOF chmod +x /root/scripts/amanda-${SERVICE}${FREQ}-backup exit 0 |
Create a crontab
...
entry
Code Block |
---|
# m h dom mon dow command 17 12 * * 1-4 /root/scripts/backup-bluelight 17 12 * * 5 /root/scripts/backup-bluelight-weekly |
...
amrecover bluelight-weekly -s cupcake.bluelight.av -t cupcake.bluelight.av