System Administration Guide, Volume I
  Rechercher uniquement dans ce livre
Télécharger cet ouvrage au format PDF

Overview of Backing Up and Restoring File Systems

41

This chapter provides guidelines and planning information on backing up and restoring complete file systems using the ufsdump and ufsrestore commands.
This is a list of overview information in this chapter.
Definition: Backing Up and Restoring File Systemspage 718
Why You Should Back Up File Systemspage 719
Choosing a Tape Devicepage 719
Planning Which File Systems to Back Uppage 720
Overview of the Backup and Restore Commandspage 722
Choosing the Type of Backuppage 723
Guidelines For Scheduling Backupspage 723
Sample Backup Schedulespage 726
For step-by-step instructions on backing up file systems using the ufsdump command, see Chapter 42, "Backing Up Files and File Systems." For step-by-step instructions on restoring file systems using the ufsrestore command, see Chapter 43, "Restoring Files and File Systems."

Definition: Backing Up and Restoring File Systems

Backing up file systems means copying file systems to removable media (such as tape) to safeguard against loss, damage, or corruption. Restoring file systems means copying reasonably-current backup files from removable media to a working directory.
This chapter describes the commands for scheduled backup and restore operations (ufsdump and ufsrestore); however, there are other commands you can use for copying files and file systems for sharing or transporting files. Table 41-1 provides pointers to all commands that copy individual files and/or file systems to media.
Table 41-1
If You Want To ...Then Use ...And Go To ...
Back up complete or individual file systems to a local or remote tape deviceufsdump commandChapter 42, "Backing Up Files and File Systems" or Chapter 44, "Reference Information on ufsdump and ufsrestore"
Back up complete file systems for all systems on a network from a serverNetworker for Solaris softwareNetworker for Solaris Administrator's Guide
Copy, list, and retrieve files on tape
Copy, list, and retrieve files on diskette
tar, cpio, or pax command
tar command
Chapter 45, "Copying UFS
Files and File Systems"
Copy master disk to a clone diskdd commandChapter 45, "Copying UFS Files and File Systems"
Restore complete file systems or
individual files from removable media
to a working directory
ufsrestore commandChapter 43, "Restoring Files
and File Systems"

Why You Should Back Up File Systems

Backing up files is one of the most crucial system administration functions. You should perform regularly-scheduled backups to prevent loss of data due to:
  • System crashes
  • Accidental deletion of files
  • Hardware failures
  • Natural disasters (for example, fire, hurricanes)
  • Problems when reinstalling or upgrading a system

Choosing a Tape Device

Table 41-2 shows typical tape devices used for storing file systems during the backup process. For more detailed information on tape devices, see Chapter 46, "Managing Tape Drives."
Table 41-2
MediaCapacityTape Length
1/2-inch reel tape40-45 Mbytes2300 feet
60-Mbyte 1/4-inch streaming cartridge tape60 Mbytes425 feet
150-Mbyte 1/4-inch streaming cartridge tape150 Mbytes700 feet
2.3-Gbyte 8-mm cartridge tape2.3 Gbytes6000 feet
5.0-Gbyte 8-mm cartridge tape5.0 Gbytes13000 feet
1 4-mm cartridge tape (DAT)----
2 3.5-inch diskette1422 blocks (1.44 Mbytes)--
1. Capacity depends on the type of drive and the data being written to the tape.
2. You can back up file systems using diskettes, but this is time-consuming and cumbersome.

Planning Which File Systems to Back Up

You should back up any file systems that are critical to users, including file systems that change frequently. Table 41-3 and Table 41-4 provide general guidelines on the file systems to back up for standalone systems and servers.
Table 41-3
Consider Backing Up These 1 File Systems ...Because ...And At This Interval ...
root (/) - partition 0 *The root (/) file system contains the kernel and may contain the /var directory in which frequently modified files are kept such as mail and accounting.At regular intervals.
/usr - partition 6 *Installing new software and adding new commands typically affects user file systems.Occasionally.
/export/homeThe /export/home file system contains directories and subdirectories of all users on the standalone system.More often than root (/) or /usr, perhaps as often as once a day, depending on your site needs.
/export , /var, or other file systemsDuring installation of Solaris software, you may have created these file systems.As your site requires.
1. Use the df command or look at /etc/vfstab file to find out on which slice a file system is located.
* Indicates file systems created by default when installing Solaris software.
Table 41-4
Consider Backing Up These 1 File Systems ...Because ...And At This Interval ...
root (/) - partition 0 *
/export - partition 3 *
/usr - partition 6 *
These file systems contain the kernel,
major commands, and executables.
Once a day to once a month depending on
your site needs.

root (/) - if you frequently add and remove
clients and hardware on the network, you
have to change important files in root (/),
including the kernel configuration file. In
this case, you should do a full back up on
the root (/) file system between once a week
and once a month. If your site keeps users'
mail in the /var/mail directory on a mail
server (which client systems then mount),
you may want to back up root (/) daily.

/export - the root (/) directory of diskless
clients is kept in the /export file system.
Because the information it contains is
similar to the server's root directory in
slice 0, it does not change frequently. You
need to back up only occasionally, unless
your site sends mail to clients' root
directories; then you should back up
/export more frequently.

/usr - contents are fairly static and only
need to be backed up from once a week to
once a month.
/export/home - partition 7 *The /export/home file system contains the home directories and subdirectories of all the users on the system; its files are volatile.Once a day to once a week.
1. Use the df command or look at /etc/vfstab file to find out on which slice a file system is located.
* Indicates file systems created by default when installing Solaris software.

Note - You do not need to back up a server's /export/swap file system.

Overview of the Backup and Restore Commands

The ufsdump and ufsrestore commands are the recommended commands for scheduled backups of complete file systems. Table 41-5 lists the tasks you can perform with them. For information on how these commands work and their syntax, see Chapter 44, "Reference Information on ufsdump and ufsrestore."
Table 41-5 ufsdumpufsrestore
With This Command...You Can ...Comments
ufsdumpBack up complete or individual file systems to local or remote tape drivesThe tape device can be on any system in the network to which the user has access. This command works quickly because it is aware of the structure of the UFS file system type, and works directly through the raw device file.
Back up incremental backupsThis enables you to back up only those files that were changed since a previous backup.
Back up groups of systems over the network from a single systemYou can run ufsdump from one system on each remote system through a remote shell or remote login, and direct the output to the system on which the drive is located. Or you can pipe the output to the dd command.
Automate backupsUse the crontab utility that calls a script that starts the ufsdump command.
Restrict user access to backup tablesUse the a option.
Determine the size of a backup without actually doing the backupUse the S option.
Keep a log file of each dump recordUse the u option.
Verify contents of the tape against the source file systemUse the v option.
ufsrestoreRestore individual or complete file systems from a local or remote tape drive

Choosing the Type of Backup

With the ufsdump command, you can perform full or incremental backups. Table 41-6 lists the differences between these types of backup procedures.
Table 41-6
This Type of
Backup ...

Copies ...
And Has These
Advantages ...
And These
Disadvantages ...
FullA complete file system or directory.More difficult to retrieve small changes in file systems.Requires large numbers of backup tapes that take a long time to write. Takes longer to retrieve individual files because the drive has to move sequentially to the point on the tape where the file is located.
IncrementalOnly files in the specified file system that have changed since a previous backup.Easier to retrieve small changes in file systems.Finding which incremental tape a file is on can take time.

Guidelines For Scheduling Backups

A backup schedule is the schedule you establish to run the ufsdump command. This section provides guidelines on the factors to weigh when creating a backup schedule, guidelines on how often to back up file systems, and sample backup schedules.

What Drives a Backup Schedule

The schedule you create depends on:
  • Your need to minimize the number of tapes
  • Time available for doing backups
  • Time available to do a full restore of a damaged file system
  • Time available for retrieving individual files that get accidentally deleted

How Often Should You Backup?

If you do not need to minimize time and media spent on backups, you can do full backups every day. However, this is not realistic for many sites, so incremental backups are most often used. In this case, it is recommended that you back up your site to be able to restore files from the last four weeks. This requires at least four sets of tapes--one for each week, which you would rotate each month. In addition, you should archive the monthly backups for at least a year, and then keep a yearly backup for a number of years.

Using Dump Levels to Create Incremental Backups

The dump level you specify in the ufsdump command (0-9) determines which files are backed up. Specifying dump level 0 creates a full backup. Numbers 1-9 are used to schedule incremental backups, but have no defined meanings. Numbers 1-9 are just a range of numbers used to schedule cumulative or discrete backups. The only meaning levels 1-9 have is in relationship to each other, as a higher or lower number.
The following examples show the flexibility of the incremental dump procedure using levels 1-9.

Dump Levels For Daily, Cumulative Backups

Doing daily, cumulative incremental backups is the most commonly used backup scheme and is recommended for most situations. The following example shows a schedule using a level 9 dump each day, and a level 5 dump on Friday to restart the process.

Note - In the following example, you could have used other numbers in the 1-9 range to produce the same results. The key is having the same number each day, with any lower number on Friday. For example, you could have specified levels 4, 4, 4, 4, 2 or 7, 7, 7, 7, 5.

Graphique

Figure 41-1

Dump Levels For Daily, Discrete Backups

The following example shows a schedule where you capture only a day's work on different tapes. In this case, sequential dump level numbers are used during the week (3,4,5,6) with a lower number (3) on Friday.

Note - In the following example, you could have used the sequence 6,7,8,9 followed by 2, or 5,6,7,8 followed by 3. Remember, the number themselves have no defined meaning; you attribute meaning by ordering them in a high/low sequence.

Graphique

Figure 41-2

Sample Backup Schedules

This section provides sample backup schedules. All schedules assume you begin with a full backup (level 0), and that you use the u option to record each backup.

Example--Daily Cumulative, Weekly Cumulative Backups

Table 41-7 shows the most commonly used incremental backup schedule; it is recommended for most situations.
Table 41-7

FloatingMonTuesWedThursFri
1st of Month0




Week 1
99995
Week 2
99995
Week 3
99995
Week 4
99995
With this schedule:
  • Each weekday tape accumulates all files changed since the end of the previous week (or the initial level 0 for the first week).
  • Each Friday's tape contains all the files changed since the first level 0. For the level 9 backups, the previous level 0 or level 5 is the closest backup at a lower level.
  • All files that have changed since the lower-level backup at the end of the previous week are saved each day.
  • For each Friday level 5, the nearest lower-level backup is the level 0 done at the beginning of the month. Therefore, each Friday's tape contains all the files changed during the month to that point.
Table 41-8 shows how the contents of the tapes can change across two weeks.
Table 41-8

MonTuesWedThursFri
Week 1a ba b ca b c da b c d ea b c d e f
Week 2gg hg h ig h i ja b c d e f g h i j k

Example--Daily Cumulative, Weekly Incremental Backups

Table 41-9 shows a schedule where each weekday tape accumulates all files that changed since the beginning of the week (or the initial level 0 for the first week), and each Friday's tape contains all the files changed that week.
Table 41-9

FloatingMonTuesWedThursFri
1st of Month0




Week 1
99993
Week 2
99993
Week 3
99994
Week 4
99995
Table 41-10 shows how the contents of the tapes can change across two weeks.
Table 41-10

MonTuesWedThursFri
Week 1a ba b ca b c da b c d ea b c d e f
Week 2gg hg h ig h i jg h i j k
Tape Needs With this schedule, you will need six tapes (if you want to reuse daily tapes), or nine tapes (if you want to use four different daily tapes): one for the level 0, four for the Fridays, and one or four daily tapes.
If you need to restore a complete file system, you will need five tapes: the level 0, all preceding Friday tapes (three), and the most recent daily tape.

Example--Daily Incremental, Weekly Cumulative Backups

Table 41-11 shows a schedule where each weekday tape contains only the files changed since the previous day, and each Friday's tape contains all files changed since the initial level 0 at the beginning of the month.
Table 41-11

FloatingMonTuesWedThFri
1st of Month0




Week2
34562
Week3
34562
Week4
34562
Table 41-12 shows how the contents of the tapes can change across two weeks.
Table 41-12

MonTuesWedThFri
Week1a bc de f gha b c d e f g h i
Week2j k lmn op qa b c d e f g h i j k l m n o p q r s
Tape Needs With this schedule you will need at least nine tapes: one for the level 0, four for the Fridays, and four daily tapes, assuming you reuse daily tapes each week, which is not recommended. If you save the weekly tapes for a month, you need 21 tapes.
If you need to restore the complete file system, you need six tapes: the level 0, the most recent Friday tape, and all the daily tapes for that week.

Example--Backup Schedule for a Server

Table 41-13 shows an example backup strategy for a heavily-used file server on a small network where users are doing file-intensive work, such as program development or document production. It assumes that the backup period begins on a Sunday and consists of four seven-day weeks.
Table 41-13
DirectoryDateLevelTape Name
/1st Sunday0n tapes
/usr1st Sunday0"
/export1st Sunday0"
/export/home1st Sunday0"
1st Monday9A
1st Tuesday9B
1st Wednesday5C
1st Thursday9D
1st Friday9E
1st Saturday5F
/2nd Sunday0n tapes
/usr2nd Sunday0"
/export2nd Sunday0"
/export/home2nd Sunday0"
2nd Monday9G
2nd Tuesday9H
2nd Wednesday5I
2nd Thursday9J
2nd Friday9K
2nd Saturday5L
/3rd Sunday0n tapes
/usr3rd Sunday0"
Table 41-13 (Continued)
DirectoryDateLevelTape Name
/export3rd Sunday0"
/export/home3rd Sunday0"
3rd Monday9M
3rd Tuesday9N
3rd Wednesday5O
3rd Thursday9P
3rd Friday9Q
3rd Saturday95R
/4th Sunday0n tapes
/usr4th Sunday0"
/export4th Sunday0"
/export/home4th Sunday0"
4th Monday9S
4th Tuesday9T
4th Wednesday5U
4th Thursday9V
4th Friday9W
4th Saturday5X
With this plan, you use 4n tapes (the number of tapes needed for four full backups of /, /usr, /export, and /export/home), plus 24 additional tapes for the incremental backups of /export/home. This plan assumes that each incremental backup uses one tape and you save the tapes for a month.
Here's how this plan works:
  1. On each Sunday, do a full backup (level 0) of /, /usr, /export, and /export/home. Save the level 0 tapes for at least 3 months.

  2. On the first Monday of the month, use tape A to do a level 9 backup of /export/home. ufsdump copies all files changed since the previous lower-level backup (in this case, the level 0 backup that you did on Sunday).

  3. On the first Tuesday of the month, use tape B to do a level 9 backup of /export/home. Again, ufsdump copies all files changed since the last lower-level backup--Sunday's level 0 backup.

  4. On the first Wednesday, use tape C to do a level 5 backup. ufsdump copies all files changed since Sunday.

  5. Do the Thursday and Friday level 9 backups on tapes D and E. ufsdump copies all files changed since the last lower-level backup--Wednesday's level 5 backup.

  6. On the first Saturday of the month, do a level 5 backup of /export/home, which copies all files changed since the previous lower-level backup--in this case, the level 0 backup you did on Sunday. Store tapes A-F until the first Monday of the next 4-week period, when you use them again.

  7. Repeat steps 1-6 for the next three weeks, using tapes G-L and 4n tapes for the level 0 on Sunday, and so on.

  8. For each 4-week period, repeat steps 1-7, using a new set of tapes for the level 0s and reusing tapes A-X for the incremental backups. The level 0 tapes could be reused after 3 months.

This plan lets you save files in their various states for a month. It requires many tapes, but ensures that you have a library of tapes to draw upon. To reduce the number of tapes, you could reuse Tapes A-F each week.

Other Backup Scheduling Recommendations

Table 41-14 provides other recommendations for scheduling backups.
Table 41-14
If You ...Then ...Comments
Need to restore different versions of files (for example, file systems used for word processing)· Do daily incremental backups every working day.This schedule saves all files modified that day, as well as those files still on disk that were modified since the last backup of a
· Do not reuse the same tape for daily incremental backups.level lower. However, with this schedule you should use different tapes each day because a file changed on Tuesday, and again on Thursday, goes onto Friday's lower-level backup looking like it did Thursday night--not Tuesday night. If a user needs the Tuesday version, you cannot restore it unless you have a Tuesday backup tape (or a Wednesday backup tape). Similarly, a file that is present on Tuesday and Wednesday, but removed on Thursday, does not appear on the Friday lower-level backup.
Need to quickly restore a complete file systemDo lower-level backups more frequently.--
Are backing up a number of file systems on the same serverConsider offsetting the schedule for different file systems.This way you're not doing all level 0s on the same day.
Need to minimize tapes· Increase the level of incremental backups done across the week.This means only changes from day to day are saved on each daily tape.
· Increase the level of backups done at the end of the week.This means only changes from week to
· Put each day's and week's incremental backups onto the same tape.week (rather than the entire month) are saved on the weekly tapes.

This is done by using the no rewind option in the ufsdump command.