Download presentation
Presentation is loading. Please wait.
Published byCynthia Todd Modified over 9 years ago
1
1 CSC2405: System Administration Week 5 -- Backup what to do? where to? which way? Tools?
2
Week 5: backup2 Invaluable information Information stored on the computer always more valuable than the computer itself. data from an experiment which you can not repeat due to the files accidentally deleted nature disaster, fire, flood Protecting this information is one of the system administrator’s most important tasks tedious not so creative
3
Week 5: backup3 Backup Policy Backup is the best way to protect the valuable data. protection against data lose recovery from filesystem damage A backup policy is a written statement which contains What to backup? Backup strategies Backup devices and media Backup tools
4
Week 5: backup4 Backup policy: what do backup? Installed system files executables in /usr, /usr/bin, /lib /usr/lib, etc They never changes or change slowly. Frequent backup is not really necessary. Local system files resident in /usr/local, extra packages after the basic install System configuration files /etc, /usr/local, /usr/local/etc, Service files /var, services such as Web, Mail, News, DNS, NIS, LDAP, database servers User files /home, personal files of users on the system
5
Week 5: backup5 Backup strategies Backup sometimes is very time-consuming. Full backup and incremental backup need to be used accordingly. Fully backup is to copy all the files on the system onto a tape or other backup media. An incremental backup contains only those files that have changed since some previous backup. Incremental backups are used when full backups are large and only a small amount of data changes within a given period of time.
6
Week 5: backup6 Incremental backup level An incremental backup level is just a numeric value that is arbitrarily assigned by the system administrator. The values for these levels range from 0 to 9, with 0 always being a full backup. Every level-n incremental backup backs up all files changed since the previous backup at a lower level. A differential backup is a type of incremental backup which only backs up changed files since the last differential backup. Some backup software interpret repeated level 9 backup as `different’ backups.
7
Week 5: backup7 Design backup strategies Although site specific, a few basic decisions How often must I do a full backup? How often must I do an incremental backup? How much can I spend on backup media? How far in the past must I store backups? Do I need to store backup only for a full rebuild? or Do I need to recover accidentally deleted files? How confident I am that my backup media will not fail?
8
Week 5: backup8 Backup examples A full backup will be carried out every week or every month around the calendar Sun Mon Tues Wed Thur Fri Sat 0 0 0 0 0 0 0 A more practical backup schedule Sun Mon Tues Wed Thur Fri Sat 0 2 2 2 2 2 4
9
Week 5: backup9 A more realistic backup schedule A backup schedule that uses a new level everyday. The advantage of this schedule less time and less media Disadvantage changed files are backed up once need six volume to restore the system on Friday. Sun Mon Tues Wed Thur Fri Sat 0 1 2 3 4 5 6
10
Week 5: backup10 Storing backups Storing backups needs to be on removable media. There is not much point in storing backups on a second disk if the controller fails. Storing backups on a separate computer is not a very effective insurance against natural disaster if the backup computer is in the same room. Companies concerned with the preservation of their backup data will normally store them with a third party that provides magnetically shielded, temperature controlled, humidity controlled storage facilities.
11
Week 5: backup11 Backup devices and media Backup devices and features Floppies: small capacity, slow, better for moving data rather than storing data Super Floppies – Iomega’s Zip drive (250MB), larger capacity, faster, but cost more. Better for moving data, a bit wasteful if storing data. CD-R and CD-RW – 700MB, cheap, last long, good for incremental backup. It is time consuming, difficult and also costly for full backup. DVD – 2GB, a bit too costly Removable hard disks – High capacity, good choice for backups. Also faster transferring. Costly drive and costly media.
12
Week 5: backup12 Tapes and hard drives Tapes – preferred backup media. largest capacity long lifetime Many formats and tape drives Exabyte tape drives takes the standard 8mm videotapes. A standard tape can hold 7GB. DAT: Digital Audio Tape drives are also helical scan devices that use 4mm cartridges. Currently DAT cartridges can hold upto 20GB and have a transfer of 2.5MB/s. DLT: Digital Liner Tape drives are reliable and affordable and the tape hold upto 40GB, with 6MB/s transfer speed. Hard drive – viable alternative backup media Not on the same machine
13
Week 5: backup13 Comparison of backup media MediumCapacitySpeedRelative cost Floppy disk Zip 250 CD-R Jaz Exabyte DAT DLT 2.8MB 250MB 700MB 2GB 7GB 20GB 40GB <100KB/s 900KB/s 2.4MB/s 7.4MB/s 1MB/s 2.5MB/s 6MB/s 1 40 2 100 40 160 200
14
Week 5: backup14 Who does Backup Manual backup used to be the mainstream. Robots were used in some lab. at command is used to do something once for ever. Backups are periodic process. Periodic execution is normally handled by the cron daemon. cron starts when the system boots and remaining as long as the system is up. it reads one or more configuration files that contains command lines to execute and the time at which they are to be executed.
15
Week 5: backup15 cron and crontab A cron configuration file is called a “crontab” or “cron table” file. stored in /var/spool/cron directory, /etc/cron.d directory, /etc/crontab file A user’s crontab file is stored in the directory /var/spool/cron. A user has at most one crontab file crontab files are named with the login names of the user they belong to. When cron starts, it reads all of its config files, stores them in memory, and then goes to sleep. Once a minute, cron wakes up, checks the modification times on all the crontab files, reloads any new or changed files, and then executes any tasks scheduled for that minute before returning to sleep.
16
Week 5: backup16 crontab files All crontab files share a similar format. Blank lines are ignored all lines who’s first non-blank character is # syntax minute hour monthday month weekday [username] command username field is found only in the /etc/crontab file and the files found in /etc/cron.d directory
17
Week 5: backup17 Fields in crontab file FieldRangeDescription Minute Hour Monthday Month weekday 0-59 0-23 1-31 1-12 0-6 Minute of the hour Hour of the day Day of the month Month of the year Day of the week A star, which matches all values for that field A single integer which matches exactly A range of values, two integers separated by a bash A comma-separated list
18
Week 5: backup18 Examples The following are valid time specifications for cron 45 10 * * 1-510:45Am, Monday to Friday 0,30 * * * 5Every half hour on Friday * 0-21/3 1 * *Every third hour on the first day of the month 17 2 * 25 * 12:17AM every 25 th of the month and every Monday
19
Week 5: backup19 crontab command As all crontab files are owned by the superuser normal users use a setuid program to edit their own crontab file in the directory /var/spool/cron. crontab allows the user to create or edit their own crontab file. The option –u to crontab allows “root” to view or edit another user’s crontab file. all users can create crontab files. Two conf files allow the sysadmin override this policy: /etc/cron.allow and /etc/cron.denu
20
Week 5: backup20 An important command to backup - find The find program searches the specified parts of the filesystem for files that match a given criterion. Backup is to copy all files/filesystems which matches some criterion onto portable media. The form of command find [path…] [criterion] where path… specifies a list of files to be tested against the criterion
21
Week 5: backup21 Backup tools Linux comes with a number of basic backup and restore utilities dd: very low level command copying bits of information cpio: high-level, packing data on your backup medium, correcting errors tar: high-level, packing data and compressing data dump/restore: incremental backup
22
Week 5: backup22 dd command It does not have knowledge of the structure of the data it is coping. dd can copy a single file, a part of file, a raw partition, or a part of a raw partition dd can copy data from stdin to stdout while modifying it en route syntax: dd if=device of=device bs=blocksize. The data is written directly onto the device, not via a filesystem.
23
Week 5: backup23 dd if=device of=device bs=blocksize if: specify the input file from which dd is going to copy the data. It can be disk parition, a full disk, a CDROM or a tape device. If not specified, dd reads from stdin. of: output file to where dd is going to write the data. any devices like if. If not specified, then dd writes to stdout. bs: specifies the block size, ot the amount of data is to be transferred in one I/O operation.
24
Week 5: backup24 dd example Copy all the bytes on a floppy disk to a file on system hard disk called diskette.img dd if=/dev/fd0 of=diskette.img
25
Week 5: backup25 cpio archiving program cpio performs three primary functions copying files to an archive extracting files from an archive passing files to another directory tree. When creating an archive, cpio takes the list of files to be processed from the standard input, then sends the archive to the standard output (or a file or device specified by a cpio option). Usually find is used to provide this list to the standard input of cpio.
26
Week 5: backup26 cpio syntax and example syntax copying: cpio –ov > achive extracting: cpio –iv < archive examples cpio –ov > /dev/st0 < /tmp/list_of_files copying all files whose name in /tmp/list_of_files file to SCSI tape find. –depth print | cpio –ov > dir.cpio find a list of files and then copy them to a file
27
Week 5: backup27 cpio syntax and example examples cpio –idv < dir.cpio extract the files from the dir.cpio archive to the current directory. The –d option tells cpio to create directories as they are needed. cpio –ivt < /dev/st0 go back and check the backup by reading the tape and checking the table of contents.
28
Week 5: backup28 tar - tape archiving tar was used to store file conveniently on magnetic tape. tar archives are extremely portable between Unix platforms and are readable on other operating systems. syntax create: tar –cvf device pattern extract: tar –xvf device [filename…] you may restore some files from the archive by specifying their filename.
29
Week 5: backup29 tar examples If the floppy is really too small for that amount of data but you still want to use diskettes tar –cvMf /dev/fd0 /mydata To compress data tar –czvf /dev/st0 /mydata -p option may well be the most important tar option of them all. This tells tar to preserve permissions and ownership information in both backups and restore. The latest versions of tar will allow the user to specify a file containing a list of file to archieve. find /home –user $USER –depth > file.list tar –zcvf ${SER}.tag –T file.list
30
Week 5: backup30 a duo of backup dump/restore are relatively sophisticated backup commands. at most sites, dump/restore are the underlying commands used by automated backup software dump builds a list of files that have been modified since a previous dump, then packs those files into a single large file to archive on an external device. backups can span multiple tapes files of any type (even devices) can be backed up and restored Permissions, ownership and modification times are preserved. Backups are performed incrementally
31
Week 5: backup31 dump/restore syntax dump –level –ffilename filesystem restore –rf device examples dump -0uf - /dev/hdb1 | cat > /dev/st0 0: full backup u: to update /etc/dumpdates after it has successfully complete -: redirect to standard out, then use pipe to redirect that to a tape drive.
32
Week 5: backup32 dump/restore syntax examples dump -1uf - /dev/hdb1 | cat > /dev/st0 level 1 incremental backup restore –rf /dev/st0 must use mke2fs to recreate the file system cd to that directory
33
Week 5: backup33 Identity backups To backup every essential files such as its configuration file is called identity backup. it will collect all the files that make you put- together server unique among all other put- together servers. You can reinstall Linux from the CD-ROM in minutes, but getting everything just right might take a little longer than that and users want their e-mail and Internet access yesterday.
34
Week 5: backup34 identity backup script On this server of yours, you may be running diald, fetchmail, IP asquerading, and e-mail. using the –p flag on mkdir to save create entire subdirectory in one pass you could tar the whole thing to a floppy and save yourself a step. Alternatively, you can ftp the file to another server, a Window PC or to your own server.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.