CentOS Amanda Backup

From Nonecks Docs

Jump to: navigation, search

Contents

Installing Amanda Open Source Backup:

Set Blockzise in modprobe.conf

# vi /etc/modprobe.conf
  • And add:
st buffer_kbs=256 
  • then :wq

Install all Amanda Backup Packages

# yum install amanda*
  • Install all amanda binaries

Enable Services in xinetd

# vi /etc/xinetd.d/amanda
# vi /etc/xinetd.d/amandaidx

Change Disable = yes to Disable = no.

  • Allow the amanda services in xinetd

Determine Tape Type

  • At this point I installed screen and ran amtapetype to determine drive speeds and capacity
# yum install screen
# screen
# dmesg | grep scsi tape
st 4:0:0:0: Attached scsi tape st0
# amtapetype -f /dev/st0
Ctrl A+D
  • Let that run, it could take up to 72 hours to complete.

Copy Amanda conf files:

# mkdir /etc/amanda/auctiva
# cp -r /etc/amanda/DailySet1 /etc/amanda/auctiva
  • If by chance your files end up in a subfolder called DailySet1 move them back
# mv /etc/amanda/auctiva/DailySet1/* /etc/amanda/auctiva/

Edit amanda.conf:

# vi /etc/amanda/auctiva/amanda.conf
  • At this point I've got 3 Servers Involved
    • Amanda Backup Server(Pig)
    • FreeNAS Storage Holding Tank(Nas)
    • Chi-Srv2(Chi-Srv2)
  • I want to take Data from Chi-Srv2 and backup to FreeNAS(sdb on Amanda Server) and then Push it to tape from Amanda.
    • Here I would need to specify the Holding Disk and Tape Types in /etc/amanda/auctiva/DailySet1/amanda.conf
  1. The Holding Disk (/mnt/data/hold = iSCSI target block device hosted on FreeNAS)
holdingdisk hd1 {
   comment "main holding disk"
   directory "/mnt/data/hold"  # where the holding disk is
   use -50 Gb          # how much space can we use on it
                       # a non-positive value means:
                       #        use all space but that value
   chunksize 1Gb       # size of chunk if you want big dump to be
                       # dumped on multiple files on holding disks
                       #  N Kb/Mb/Gb split images in chunks of size N
                       #             The maximum value should be
                       #             (MAX_FILE_SIZE - 1Mb)
                       #  0          same as INT_MAX bytes
   }
  • First we'll add our Virtual Hard Disk Tapes instead of our actual Tape device because we are using Amanda to backup to Harddisk, and then we can push data to the Tape drive and eventually create cron jobs to push the critical data to the tape on a daily schedule.
define tapetype HARDDISK {
    comment "Backup to Virtual Tape"
    length 10240 mbytes
}
  • I also added our HP Ultrium LTO3 tape device if later we wish to backup to tape, see Notes below for links on Tape Types
define tapetype LTO3-400 {
   comment "LTO Ultrium 3 400/800, compression off"
   length 402432 mbytes
   filemark 0 kbytes
   speed 71702 kps
}

Edit disklist

  • Tell Amanda which servers, directory to backup, what dumptype to use
vi /etc/amanda/auctiva/disklist
  • Remove every line including “localhost /etc comp-root-tar” at the end of the file. And add our local servers:
chi-srv2        //chi-srv2/Groups/Apps  comp-user-tar
chi-srv2        //chi-srv2/Groups/IT    comp-user-tar
chi-srv2        //chi-srv2/Groups/Devs  comp-user-tar
chi-srv2        //chi-srv2/Groups/      comp-user-tar
rrussell        //backup        comp-user-tar
    • Note: See amanda.conf for the dumptype.

Edit hosts file:

vi /etc/hosts

Add all hosts we will be backing up:

10.0.1.14 chi-srv2
10.0.1.18 rrussell

Create backup directory

  • We will store the backup here
    • This is an iSCSI block device mounted to /mnt/data/ from our FreeNAS box 10.0.1.4
# mkdir -p -m 770 /mnt/data/auctiva/slots
# chown -R amanda:disk /mnt/data/auctiva

Create tape list:

# cd /mnt/data
# mkdir auctiva/hold
# touch /etc/amanda/auctiva/tapelist
# chown -R amanda:disk /mnt/data/auctiva

Create slots (virtual tapes):

# su - amanda
# cd /mnt/data/auctiva/slots
# for ((i=1; $i<=15; i++)); do mkdir slot$i; done
# ln -s slot1 data

Test virtual tapes:

# ammt -f file:/mnt/data/auctiva/slots status
file:/mnt/data/auctiva/slots status: ONLINE

Label the Tapes

for ((i=1; $i<=15; i++)); do /usr/sbin/amlabel auctiva auctiva-$i slot $i; done
  • Now you may get errors such as:
amlabel: label auctiva-1 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-2 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-3 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-4 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-5 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-6 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-7 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-8 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-9 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-10 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-11 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-12 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-13 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-14 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
amlabel: label auctiva-15 doesn't match labelstr "^Auctiva-[0-9][0-9]*$"
  • This means that the amanda.conf file has an incorrect or non-matching 'labelstr' value
labelstr "^Auctiva-[0-9][0-9]*$" 

changed to

labelstr "^auctiva-[0-9][0-9]*$"  

I then re-ran the command:

for ((i=1; $i<=15; i++)); do /usr/sbin/amlabel auctiva auctiva-$i slot $i; done 
  • (I could have changed the command to 'for ((i=1; $i<=15; i++)); do /usr/sbin/amlabel auctiva Auctiva-$i slot $i; done' as well, which would have worked, but i chose to change the amanda.conf file to a lowercase letter to avoid case sensitive issues.)

Output should be similar to the following:

changer: got exit: 0 str: 1 file:/mnt/data/auctiva/slots
labeling tape in slot 1 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-1, checking label, done.
changer: got exit: 0 str: 2 file:/mnt/data/auctiva/slots
labeling tape in slot 2 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-2, checking label, done.
changer: got exit: 0 str: 3 file:/mnt/data/auctiva/slots
labeling tape in slot 3 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-3, checking label, done.
changer: got exit: 0 str: 4 file:/mnt/data/auctiva/slots
labeling tape in slot 4 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-4, checking label, done.
changer: got exit: 0 str: 5 file:/mnt/data/auctiva/slots
labeling tape in slot 5 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-5, checking label, done.
changer: got exit: 0 str: 6 file:/mnt/data/auctiva/slots
labeling tape in slot 6 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-6, checking label, done.
changer: got exit: 0 str: 7 file:/mnt/data/auctiva/slots
labeling tape in slot 7 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-7, checking label, done.
changer: got exit: 0 str: 8 file:/mnt/data/auctiva/slots
labeling tape in slot 8 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-8, checking label, done.
changer: got exit: 0 str: 9 file:/mnt/data/auctiva/slots
labeling tape in slot 9 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-9, checking label, done.
changer: got exit: 0 str: 10 file:/mnt/data/auctiva/slots
labeling tape in slot 10 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-10, checking label, done.
changer: got exit: 0 str: 11 file:/mnt/data/auctiva/slots
labeling tape in slot 11 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-11, checking label, done.
changer: got exit: 0 str: 12 file:/mnt/data/auctiva/slots
labeling tape in slot 12 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-12, checking label, done.
changer: got exit: 0 str: 13 file:/mnt/data/auctiva/slots
labeling tape in slot 13 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-13, checking label, done.
changer: got exit: 0 str: 14 file:/mnt/data/auctiva/slots
labeling tape in slot 14 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-14, checking label, done.
changer: got exit: 0 str: 15 file:/mnt/data/auctiva/slots
labeling tape in slot 15 (file:/mnt/data/auctiva/slots):
rewinding, reading label, not an amanda tape (Read 0 bytes)
rewinding, writing label auctiva-15, checking label, done. 

Reset the tape:

/usr/sbin/amtape intra reset

Edit .amandahosts

  • We have to allow communications from clients:
vi /var/lib/amanda/.amandahosts
  • Add the following:
server1 amanda
server2 amanda
server3 amanda
client1 amanda
client2 amanda

Substitute server/client names to your device names

Start xinetd service:

su –
service xinetd start

Check amanda process:

lsof | grep amanda

Client Configuration

  • Pending..