1 / 24

Backups

Backups. Ching-li Peng CMSC691X Date: June 11, 2002. Contents. General rules of backups Backup devices and media Setting up an incremental backup regime Restoring from dumps Dumping and restoring for upgrades Using other archiving programs Using multiple files on single tape AMANDA.

ashtyn
Télécharger la présentation

Backups

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Backups Ching-li Peng CMSC691X Date: June 11, 2002

  2. Contents • General rules of backups • Backup devices and media • Setting up an incremental backup regime • Restoring from dumps • Dumping and restoring for upgrades • Using other archiving programs • Using multiple files on single tape • AMANDA

  3. General rules • Perform all dumps from one machine • rdump allows you to perform dumps over the network • You can also use dd takes care of byte swapping problem but not for different versions of rdump. • Label your tapes • Clearly, complete and unique id their contents • Pick a reasonable backup interval • The more often backups are done, the smaller amount of data can be lost. • Busy system—back up every workday. However, unheavy system, back up a week. • Choose filesystems carefully • /etc/passwd –is copied to other partition everyday and backup regularly • /tmp directory –do not need to backup

  4. General rules—cont. • Make daily dumps fit on one tape • Do daily dumps of all your user filesystems onto a single tape. • Mount a tape every day before you leave work and run dumps late at night from cron. This way minimizes the dump impact with users. • If you cannot fit daily backup into one tape, you will consider… • Make filesystems smaller than your dump device • Dump is capable of dumpling filesystem to multiple tapes. It must prompt you change tapes and tapes should be carefully label • Keep tapes off-site • Keep backups off-site so that a disaster cannot destroy the original data and backups. • Keep the storage of backups in a climate-controlled and secure environment

  5. General rules—cont. • Protect your backups • Keep them under lock and key. Confidentiality of careness. • Limit activity during dumps • Check your tapes • Keep on monitoring the backup procedure and checking its functionality working. • First, reread tapes immediately after it has finished dumping. Scanning a tape to verify that it contains the expected files • Run restore t to generate a table of contents for each filesystem and to store the results on disk • Use grep to look up the filename and pick the newest instance

  6. General rules—cont. • Develop a tape life cycle • Design your data for backups • Use the following information to design the storage architecture: • the various kinds of data you will deal with • the expected volatility of each tape of data, • the backup frequency which you feel comfortable with potential losses • Prepare for the worst

  7. Backup devices and media • Backup should write on a removable media. For example, backup a hard disk to another provides a little protection against disk controller failure. • Most backup stores in locally. • Many tape drives compress data before write it to tapes, allowing more data to be stored than the tapes’ nominal capacity. • Although cost and media capacity are both important consideration, it is important consider throughput as well. • Fast media are more pleasant to deal with, and they allow more flexible in the scheduling of dumps.

  8. Setting up an incremental backup regime • DUMP and restore are commands to create and restore from backups. • Dump filesystem: Builds up a list of files that have been modified since last previous dump, then pack those files into a single file to archive to an external device. • Limitations • Every filesystem must be dumped individually • Only filesystems on the local machine can be dumped. However, you an dump a local filesystem to a remote tape drive with rdump • #rdump Ouf anchor:/dev/nst0 /spare

  9. Dump functionality • Dump d s Using d specifies the tape density in byte per inch, and s specifies size in kilobytes. For example, #dump 5usdf 60000 6250 /dev/rst0 /work dump [flag] [size] [density][f:send output to this tape device][filesystem] • Dump accepts many arguments, but thy do not vary too much from platform to platform,so, you must check these flags in man page you are dumping • In red hat: You have to explicitly install dump and restore on your linux systems.

  10. Setting up an incremental backup regime --cont. • Features • Incremental dumps • It does not care about the length of filenames. Hierarchies can be arbitrarily deep and long names are handled correctly. • Dump accepts many arguments • U flag: to cause dump to automatically update/etc/dumpdates. • F flag: to tell dump to send its output elsewhere. • D|s flag: to specify the tape density in bytes per inch and the tape length in cubits.

  11. Restoring form dump • Extract data from dump tapes • There are two types of restoring. • Restoring a set of files • Restoring a whole filesystem

  12. Restoring individual files To determine which tapes contain the version of files user wanted. To create and cd to a temporary directory such as /var/restore To restore i, ls, cd and pwd To mark the files you want to restore with add command When you are done selecting, type extract to pull files form the tape. Restore i reads the catalog from the tape and then lets you navigate though the directory of the dump. For example restore the file /users/janet/jamlort from a remote tape drive. Determine which tape contains this file #mkdir /var/restore #cd /var/restore #ls ~janet Janet/garth/lost!foundlost +found, #rsh tapehost mt –f /dev/nst0 fsf3 Rrestore xf tapehost:/dev/nst0 /users/janet/iam.lost Restoring individual files

  13. Restoring Entire Filesystems • Before restore entire filesystem, you must make sure that what problem caused the filesystem to be failed • Create and mount the target filesystem • cd to the mount point to the new filesystem • Put the first tape of the most recent level 0 dump in the tape drive • Type restore r command • Mount and restore the incremental dumps. Restore the dump in the order they are created

  14. Dumping and restoring for upgrades • When you perform an OS upgrade, you must back up all filesystems with a level 0 dump and restore them. • You must to backup and restore any system-specific files that are in / or /usr, such as /etc/passwd, /etc/shadow, or /usr/local. • You must do a complete setof level 0 dumps immediately after an upgrade, too.

  15. Using other archiving programs • Using tar, cpio, and dd to back up an entire system • Tar:reads multiple files or directories and packages them into one files Tar cf –fromdir |(cd todir; tar xfp- ) • Create a copy of the director tree fromdir in todir • Avoid using “..” In the todir argument, since symbolic links and automounters can make it mean something different what you expect • Drawback: • It does not allow multiple tapes volumes (if not fit in one tape?) • Pathnames are limited to 100 characters. This limitation prevents tar from being used to archive deep hierarchy

  16. Function options -c , --create a new archive -d, --compare the files store in tarfile with others -r, --append other files to the end of the existing archive -t, --list the names of files stored in archive -u, --update -x –extract, --get Examples: Create an archive of /bin and /usr/bin(c), show the command working (v), and store on the tape in /dev/rmt0: tar cvf /dev/rmt0 /bin /usr/bin List the tapes’s contents in a format like ls –l tar tvf /dev/rmt0 tar

  17. cpio cpio—copy file archives in from or out to tape or disk, or to another location on the local machine. Each of the three flags –i (copy in),-o(copy out) or –p (copy files in anther directory) #find fromdir –depth –print| cpio –padm todir • But, do not allow multiple tape volumes

  18. dd dd: copies its input files to as put files • If a user bring you a tape that was written on some non-UNIX system dd may be the ony way to read it • Newfs the destination filesystem between partition exactly the same size • Make a copy of a copy of a magnetic tape --with two tape drives, /dev/rmt8 /dev/rmt9 • With one drive /dev/rmt8 • %dd if = /dev/rtm8 of = rtm9 cbs = 166 %dd if = /dev/rtm8 of = tfile cbs=166 %dd if = tfile of = dev/rtm9 cbs= 166 %rm tfile

  19. Dump Sequence • Dump levels have meaning when they are associated with each other. • Dump can be performed on various schedules. The schedule depends on • The activity of your file systems • The capacity of your dump • Dump sequences can minimize the number of tapes consumed by each day’s backup. • Given those constrains, you can design a schedule a an appropriate level • A simple schedule • A moderate schedule

  20. Dump sequence—cont. • A simple schedule • If your disk capacity is smaller than dump device, then you can use a trivial dump scheule • Do level 0 dumps to every filesystem every day. • Reuse a group of tapes, but every n days in a tape. It costs you (365/n * price of each tape) per year • Motivation: • It provides a lot of redundancies and make data recovery very easy. • It provides safety and convenience (limited operating time), but spending a lot of money.

  21. Dump sequence—cont. • A moderate schedule • Assign a type of each day of a week, each week of the month, each month of the year. • Every day, do a level 9 dump to the daily tape • Every week, do a level 5 dump to the weekly tape’ • Every month, do a level 3 dump to the monthly tape • Every year, do a level 0 dump to the yearly tape. • It provides little redundancies and not too many tapes.

  22. Using Multiple Files on A Single Tape When dump or some other commands writes a stream of bypes out to a tape device and then closes the device file, an “end of file” marker is automatically placed on the tape. Using mt command position a tape at a particular stream or “file set,” as mt calls them. “mt”is especially useful if you put multiple files. #mt –f tapename command --tapename is the device name of the tape -- -f is forest -rew rewinds the tape to the beginning -offl put the tape offline. Some dump tape scripts use this to eject the tape. -status prints informaiton abou the current status of tape drive -fsf [count] fast-forwards the tape. [count] is default to 1. -bsf [count] backspace count files. If you are too far forward , your best bet is to rew it and start again from beginning

  23. AMANDA • The Advanced Maryland Automatic Network disk archiver, AMANDA, is a sophisticated network backup system that can replace the home-grown scripts used by many sites. • It can backup up all the machines on a LAN to a single server’s tape drive. • It supports most flavors of UNIX and many different kinds of backup media. • Amanda was originally written by James da Silva of the University of Maryland in 1991. It is now supported by a team of sysadmins form around the world.The latest information is available in www.amanda.org

More Related