180 likes | 268 Views
Chapter 11, Backups. Honglin Su CSEE, UMBC hosu@cs.umbc.edu. Agenda. Introduction Backup Devices and Media Incremental Backup Backup Rules Restoring from Dumps Dumping and Restoring from Upgrades Other Archiving Programs Summary. Introduction.
E N D
Chapter 11, Backups Honglin Su CSEE, UMBC hosu@cs.umbc.edu Honglin Su, CSEE UMBC
Agenda • Introduction • Backup Devices and Media • Incremental Backup • Backup Rules • Restoring from Dumps • Dumping and Restoring from Upgrades • Other Archiving Programs • Summary Honglin Su, CSEE UMBC
Introduction • Information stored on computers is worth more than the computers themselves • Consider your accounts stored in Banks • Hundreds of ways to lose data. • Accidental file removal, External/Internal failures • Backup - The most efficient and convenient way to protect your data • Backup must be done carefully and on a strict schedule Honglin Su, CSEE UMBC
Backup Devices and Media Honglin Su, CSEE UMBC
Backup Devices and Media • Most media use magnetic particles to store their data, these media are subject to damage by electrical and magnetic fields. • New Trends • Larger capacity devices, such as Tape libraries, using robot; others, e.g. Jukeboxes and Stackers • Higher speed: 12 MB/s Honglin Su, CSEE UMBC
Incremental Backup • 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 to an external device. • Backups can span multiple tapes • Files of any type (even devices) can be backed up and restored • Permission, ownerships, and modify times can be restored • Files with holes are handled correctly • Backups can be performed incrementally Honglin Su, CSEE UMBC
Incremental Backup • Limitation of dump: • Every filesystem must be dumped individually • If you have a disk that is partitioned , you must dump each section of the disk separately • The other limitation is that only filesystems on the local machine can be dumped • You can not dump an NFS filesystem, however, rdump can dump a local filesystem to a remote tape drive Honglin Su, CSEE UMBC
Incremental Backup Solaris Linux Maintenance Commands ufsdump(1M) NAME ufsdump - incremental file system dump SYNOPSIS /usr/sbin/ufsdump [options] [arguments] files_to_dump DESCRIPTION ufsdump backs up all files specified by files_to_dump (nor- mally either a whole file system or files within a file sys- tem changed after a certain date) to magnetic tape, diskette, or disk file. When running ufsdump, the file sys- tem must be inactive; otherwise, the output of ufsdump may be inconsistent and restoring files correctly may be impos- sible. A file system is inactive when it is unmouned or the system is in single user mode. A file system is not con- sidered inactive if one tree of the file system is quiescent while another tree has files or directories being modified. DUMP(8) UNIX System Manager's Manual DUMP(8) NAME dump - filesystem backup SYNOPSIS dump [0123456789BbhfusTdWn [argument ...]] filesystem dump [0123456789BbhfusTdWn [argument ...]] directory DESCRIPTION Dump examines files on a filesystem and determines which files need to be backed up. These files are copied to the given disk, tape or other stor- age medium for safe keeping (see the f option below for doing remote backups). A dump that is larger than the output medium is broken into multiple volumes. On most media the size is determined by writing until an end-of-media indication is returned. On media that cannot reliably return an end-of-media indication (such as some cartridge tape drives) each volume is of a fixed size; the actual size is determined by the tape size and density and/or block count options below. By default, the same output file name is used for each volume after prompting the operator to change media. Honglin Su, CSEE UMBC
Incremental Backup • Backup level 0 ~ 9 • A level zero backup places the entire filesystem on the tape • A level N dump backs up all files that have changed since the last dump level less than N. • To restore files from several sets of backup tapes to reset a filesystem to its exact state during the last backup. • dump does not care about the length of filename. Honglin Su, CSEE UMBC
Incremental Backup • Dump sequences and schedule • The schedule that is right for you depends on • The activity of your filesystems • The capacity of your dump device • The amount of redundance you want • The number of tapes you want to buy Honglin Su, CSEE UMBC
Backup Rules • Perform all dumps from one machine • using rdump, there is a performance penalty, while the ease of administration makes it worthwhile. • Label your tapes: exalabel • Pick a reasonable backup interval • The more often backups are done, the smaller the amount of data that can be lost in a crash • Choose filesystems carefully Honglin Su, CSEE UMBC
Backup Rules • Make daily dumps fit on one tape • Make filesystems samller than your dump device • Keep tapes off-site • Limit Activity during dumps • Check your tapes • Verify that the tape contains the expected files • Prepare for the worst Honglin Su, CSEE UMBC
Restoring from Dumps • Restoring individual files • restore x filename • use rrestore to extract files from rdump. • If multiple files on a single tape, use mt to position the tape at the correct dump file before running restore • Interactive restore • If your version of restore supports the i option. • Restore entire filesystems • restore r Honglin Su, CSEE UMBC
Dumping and Restoring for Upgrades • When you perform an OS upgrade, all filesystems must be backed up with a level zero dump. • Be sure to back up and restore any system-specific files that are in / or /usr, such as /etc/passwd, /usr/local, etc. • Your should do a complete set of level zero dumps immediately after an upgrade. Honglin Su, CSEE UMBC
Other Archiving Programs • tar: Package Files • cpio: ATT-ish Archiving, copy file archives in and out, similar to tar • dd: Twiddle Bits • % dd if=/dev/rmt0 of=/dev/rmt1 cbs=16b • volcopy: Duplicate Filesystems Honglin Su, CSEE UMBC
Other Archiving Programs • tar User Commands tar(1) NAME tar - create tape archives and add or extract files SYNOPSIS tar c [bBefFhiklnopPqvwX [ 0-7 ]] [ block ] [ tarfile ] [ exclude-file ] { -I include-file | -C directory file | file } ... tar r [ bBefFhiklnqvw [ 0-7 ]] [ block ] { -I include-file | -C directory file | file } ... tar t [ BefFhiklnqvX [ 0-7 ]] [ tarfile ] [ exclude-file ] { -I include-file | file } ... tar u [ bBefFhiklnqvw [ 0-7 ]] [ block ] [ tarfile ] file ... tar x [ BefFhiklmnopqvwX [ 0-7 ]] [ tarfile ] [ exclude-file ] [ file ... ] actaeon.cs.umbc.edu[130] tar cvf tmp.tar tmp a tmp/ 0K a tmp/yt.hm 12K a tmp/review1.txt 2K a tmp/email 2K a tmp/Map.ppt 31K a tmp/bob.c 1K actaeon.cs.umbc.edu[132] tar xvf tmp.tar x tmp, 0 bytes, 0 tape blocks x tmp/yt.hm, 11360 bytes, 23 tape blocks x tmp/review1.txt, 1163 bytes, 3 tape blocks x tmp/email, 1201 bytes, 3 tape blocks x tmp/Map.ppt, 31232 bytes, 61 tape blocks x tmp/bob.c, 61 bytes, 1 tape blocks Honglin Su, CSEE UMBC
Using multiple files on a single tape • mt command • rew - rewind the tape to the beginning • offl - put the tape off-line • status - show the status of the tape drive • fsf [count] - fast-forwards the tape • bsf [count] - backspace count files actaeon.cs.umbc.edu[137] mt usage: mt [ -f device ] command [ count ] Honglin Su, CSEE UMBC
Summary • Related chapters • Chapter 4, The filesystem • Chapter 7, Devices and drivers • Chapter 9, Adding a disk • Chapter 10, Periodic Processes • Chapter 17, NFS • For more information • http://www.admin.com/ • http://wwwhost.cc.utexas.edu/cc/services/unix/index.html • Q & A • Thank you! Honglin Su, CSEE UMBC