Amanda Backup Documentation
By Brad Tilley [EMAIL PROTECTED]
Advanced Maryland Automated Network Disk Archiver (AMANDA)
Introduction:
This document was written for people who have intermediate system administration
skills with Unix/Linux.
When editing files in Unix, knowledge of vi (pronounced VEE EYE; a simple
text editor present on most every Unix system on earth) is absolutely necessary.
The backup server has no GUI; all interaction is from the command prompt,
and vi is the only editor. Also, vi is installed on every Linux server
in the office. So the following vi tutorial can be applied to any of our
Linux servers.
A Quick vi tutorial:
1. view file_name will open a file for read-only viewing. You
may want to use view to safely look at the file before attempting to edit
it. To exit view, hold down the 'shift' key and press 'z'
twice.
2. Before editing a file, always copy it to another directory. If you
make a mistake or accidentally delete the file, you can use the copy you
made to make things right. For example, if you are going to edit /etc/amanda/daily0/amanda.conf,
copy it to /opt first with this command:
cp -v /etc/amanda/daily0/amanda.conf /opt
Now you are ready to edit the file.
3. vi file_name will open a file for editing.
4. Once vi has a file open, press 'i' to add or change text
in the file. You'll see the --INSERT-- message appear at the bottom
of the screen. To undo changes that you've made to the file, press'Esc'
until you hear a beep or until you no longer see the --INSERT--
message (note: pressing 'Esc' too many times won't hurt anything),
then press 'u' until you have undone the changes as farback as you
need to.
5. Once you are finished editing the file, press 'Esc' then
hold down 'Shift' and press 'z' twice to save your changes
and and exit.
6. To exit the file without saving your changes, type a ':quit!'
That's a colon followed by the word quit followed by an exclamation
point.
7. That's it! You now know how to use vi for basic text file editing,
consider yourself a true geek.
Office Environment Overview:
The office network consists of Microsoft Windows 98se, NT, and 2000
PCs. The office has three MS NT servers. Two for domain authentication
and one for cash receipts.
Note: The cash receipts server is going to be moved to the Computing
Center when the new system is implemented. We also have three Linux servers
that perform file, print, web, ftp, firewall, and backup services. Most
of these machines are standard implementations.
Backup Hardware Overview:
Tape Drives: 2 Quantum DLT 4000 stand-alone units. (In warranty until
Nov. 2002)
Note: We are budgeting for a DLT 8000 in the 2002-2003 fiscal year.
Backup Server: 1 Dell GX1 450 MHz 768 RAM with SCSI software RAID striping
RH Linux 7.2 standard server install with all patches as of 3-13-02.
Backup Media Overview:
Tape Cartridges: 15 DLT IV (5 daily) (4 weekly) (4 monthly) (2 extras)
and 2 Cleaning Tapes.
Note: The cleaning tapes should only be used when the drive calls for
them. Never insert a cleaning tape unless the 'Use Cleaning Tape'
light on the drive is on.
Backup Software Overview:
AMANDA, the Advanced Maryland Automatic Network Disk Archiver, is a
backup system that allows the administrator of a LAN to set up a single
master backup server to back up multiple hosts to a single large capacity
tape drive. AMANDA uses native dump and/or GNU tar facilities and can back
up a large number of workstations running multiple versions of Unix. AMANDA
can also use SAMBA to back up Microsoft Windows 9x/NT/2000 hosts.
Currently, there are three backup sets:
1. daily0
2. weekly0
3. monthly0 Note: monthly0 hasn't been implemented yet (3-13-02)
Note: All backups are full, there are no incrementals.
The following entries in the amanda.conf file will make amanda do full
backups every time:
dumpcycle 0
runspercycle 1
tapecycle THE_NUMBER_OF_TAPES_THAT_YOU_HAVE
Daily Backup Process Overview:
Amanda runs each night Monday through Friday as a cron
job. The daily tapes must be changed each day. Daily's do not run over
the weekend. Daily's run to /dev/nst0 the first tape drive. Amanda
does a self check at 4 PM each weekday, and alerts the administrator through
email if something is wrong. To manually run a self check, log in as root
and run this command su amanda -c "amcheck daily0" This will ensure
that all remote backup clients can be reached and that the proper tape
is loaded in the drive. Amanda emails in-depth reports at the end of each
backup to the administrator.
Sample crontab entry:
[root@reg root]# crontab -l -u amanda
0 16 * * 1-5 /usr/sbin/amcheck
-m daily0
0 19 * * 1-5 /usr/sbin/amdump
daily0
Weekly Backup Process Overview:
Weekly backups run as a cron job on Saturdays. Weekly's run to
/dev/nst1 the second tape drive. The proper tape should be loaded
in the second tape drive each Friday, this way, no one will have to come
in on the weekend to change tapes. Amanda does a self check at 4:10 PM
each Friday, and alerts the administrator through email if something is
wrong. To manually run a self check, log in as root and run this command
su amanda -c "amcheck weekly0" This will ensure that all remote
backup clients can be reached and that the proper tape is loaded in the
drive. Amanda emails in-depth reports at the end of each backup to the
administrator.
[root@reg root]# crontab -l -u amanda
10 16 * * 5 /usr/sbin/amcheck
-m weekly0
0 17 * * 6 /usr/sbin/amdump
weekly0
Monthly Backup Process Overview:
Monthly backups run as a cron job on Sundays. Monthly's run to
/dev/nst0 the first tape drive. The proper tape should be loaded
in the second tape drive on the Sunday morning of the backup (this only
happens on the first Sunday of each month). To manually run a self check,
log in as root and run this command su amanda -c "amcheck monthly0"
This will ensure that all remote backup clients can be reached and that
the proper tape is loaded in the drive. Amanda emails in-depth reports
at the end of each backup.
How to add a Windows 9x/NT/2000 client to the backup:
At the Windows client, create a share of the directory that you want
backed-up. We generally do 'My Documents' or 'Documents and Settings,'
and 'Eudora.' On 2000 PCs, only allow the user amanda from our domain
to access the share. Be sure amanda has full control of the share. On 9x
PCs, create a full share and assign a password to it. Be sure the share
name has NO WHITE SPACES.
At the amanda server, login as root. Run smbclient //PC-NAME/SHARE-NAME
-U amanda to make certain that the server can access the shares. On
9x PCs, the -U is the same as the password. Add the appropriate entries
to these two files:
1. /etc/amanda/daily0/disklist
Here is a sample disklist entry: reg //PC-NAME/PC-SHARE global
(reg is the name of the server and global is the name
of the dumptype which is defined in amanda.conf)
2. /etc/amandapass
Here is a sample amandapass entry: //PC-NAME/PC-SHARE user%pass
Once you have added new entries, copy the disklist to the other backup
directories (weekly0 and monthly0). Now run amcheck manually to make sure
that everything is OK. su amanda -c"amcheck daily0" you may want
to run amcheck on weekly0 and monthly0 as well. Amcheck will warn you that
some directories do not exist, but that's normal. The directories you are
warned about will be created during the next backup run.
Make a directory in /var/www/html/RESTORE for the machine(s)
that you added. The naming convention is Net BIOS machine name for Windows
PCs and alias for Linux PCs. For example, reg.xxx.vt.edu (the Linux backup
server) has a directory named 'reg.' dual.xxx.vt.edu (the web server) has
a directory named 'dual,' etc. A Windows PC with the Net BIOS name VIRGINIA1
has a directory named 'VIRGINIA1,' etc.
That's it, you've added a Windows PC to the backup. Be sure to read
the nightly amanda email report (if your email isn't in the amanda.conf
file, you need to add it) to make certain that the PC was backed-up successfully.
Run amverify and amrecover on the newly added PC to make certain that you
can indeed restore that PC's files; backups are worth nothing if you can't
restore! (see information about amverify and amrecover below).
How to recover files:
At the server, cd /var/www/html/RESTORE/PC_NAME_HERE and run
the amrecover command.
For example, if you need to recover daily files from the Documents and
Settings share for the PC named Virginia1, you would log in as root and
cd
/var/www/html/RESTORE/VIRGINIA1 and
then run amrecover daily0
1. Once you see the amrecover prompt, type sethost reg
2. Type setdate YYYY-MM-DD or setdate ---DD if you just
want to set the day for the current month. Note: the setdate command is
intended to set the date to the point back in time where you
want to recover the file/folder from.
3. Type setdisk //VIRGINIA1/docs
4. Type add * to recover all files and folders or add NAME_OF_SPECIFIC_FILE/FOLDER
to only recover a few files/folders. You can cd to any directory listing
in the backup and add as many
files/folders as you like. To add files/folders with white spaces in
their name, be sure to enclose the file/folder name with " " For example,
it should be add "My Documents" not add My
Documents
5. Once you are finished adding files to be recovered, type extract
6. AMANDA will tell you which tape it needs for the recovery; get it
and load it into the appropriate drive.
7. The files/folders you added will now be recovered to the pwd.
8. Once the recovery is complete and you see the amrecover prompt type
quit
or exit
9. Goto the PC named VIRGINIA1 and navigate to http://reg.xxx.vt.edu/RESTORE/VIRGINIA1
to get the recovered files. Or, if you need to recover entire directories,
ftp to
reg.xxx.vt.edu and download whichever directory you need.
10. The username for http or ftp recovery is XXX the password is XXX
How to verify backups:
Verification of backups is important and should be done at least once
every month. Load a random tape and run amverify daily0 weekly0
or monthly0 depending on which backup set you'd like to verify. The verify
should run without producing any errors. It's best to verify one tape form
each backup set.
What to do when you forgot to switch tapes or have been out for a
few days:
AMANDA runs as usual leaving all the files on the hard drive, however,
it reports an incorrect tape error in the email report. You must manually
flush these files from the hard drive to the correct tape by running su
amanda -c "amflush daily0" If you were out for more than one day, AMANDA
records and stores all of the missed backups on the hard drive and allows
you to flush each missed backup to the correct tape.
How to remove a Windows PC from the backup:
Remove the PC's entry from /etc/amanda/daily0/disklist and from
/etc/amandapass.
You'll also need to get the weekly0 and
monthly0 disklist
entries too. That's all there is too it.
Some notes on using native Unix utils for disaster recovery:
What if a bolt of lighting strikes the server rack's electrical outlet,
overwhelms the UPS surge protectors and damages all the servers? All you're
left with is the backup tapes in the vault. So, you'll have to restore
form them. Below are some tips on how to do this.
First, attach the tape drives to a PC's external SCSI interface and
then install Linux.
To restore the files on the tapes follow these steps:
-
mt -f /dev/nst0 rewind
-
mt -f /dev/nst0 fsf 1
-
cd to a /tmp directory
-
dd if=/dev/nst0 bs=32k skip=1 | /bin/tar -xvf -
Each time you do the dd command, dd and tar restore one amanda
image which is a disklist entry. To read the amanda header so you
can see what the image contains and which PC it came form do:
dd if=/dev/nst0 bs=32k count=1 if it's the image you want use
the dd/tar command to restore it, if not go to the next image header
and view it.
To discover the blocksize of an unknown tape do dd if=/dev/nst0 bs=128k
of=junk count=1
If the tape's bs is smaller than 128k, then the size of the 'junk'
file will be the actual bs.
If the tape's bs is larger than 128k, then dd will return an I/O error.
Increase the bs until you don't get an error, then ls -alh the junk
file. (Thanks to W. CurtPreston for this tip)
To erase a tape do mt -f /dev/nst0 erase (this will take a long
time!)
To tar directly to tape do tar cvzf /dev/nst0 name_of_dir1 name_of_dir2
To verify taped tars do tar tzf /dev/nst0 (NOTE: if not compressed,
skip the z option).
Misc:
/etc/amanda/name_of_backup/amanda.conf = main config file
/etc/amanda/name_of_backup/disklist = machines and shares to be backed
up
/etc/amandapass = List of Windows PCs with username%passwd for smbclient
smbpasswd -j NT_DOMAIN_NAME -r PDC (may have to delete and recreate
server in NT server mgr)
smbclient //PC_NAME/SHARE_NAME -U USER_NAME
/etc/hosts.allow = amandad : NAME_OF_AMANDA-SERVER (applies to Linux
only)
/etc/xinetd.d/amanda = must be turn on on client (applies to Linux
only)
/etc/xinetd.d/amidxtape = must be turned on on server (applies to Linux
only)
/etc/xinetd.d/amandaidx = must be turned on on server (applies to Linux
only)
/var/lib/amanda = amanda's home directory on the server
/var/lib/amanda/.amandahosts = applies to Linux only
crontab -e -u amanda will allow you to automate the daily, weekly,
and monthly backup
su amanda -c "amlabel NAME_OF_BACKUP NAME_OF_TAPE" creates/labels
tapes
su amanda -c "amrmtape backup_name tape_name" removes tape from
backup.
|