This chapter provides guidelines and planning information for backing up and restoring UFS file systems by using the ufsdump and ufsrestore commands.
This is a list of the overview information in this chapter.
Backup or Restore Task |
For More Information |
---|---|
Back up file systems by using the ufsdump command. | |
Create UFS snapshots by using the fssnap command. | |
Restore file systems by using the ufsrestore command. | |
Copy files and directories by using the cpio, dd, pax, and cpio commands. |
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 ufsdump and ufsrestore commands for backing up and restoring UFS file systems. Other commands are available for copying files and file systems for the purpose of sharing or transporting files. The following table provides pointers to all commands that copy individual files and file systems to other media.
Table 23–1 Commands for Backing Up and Restoring Files and File Systems
Task |
Command |
For More Information |
---|---|---|
Back up one or more file systems to a local tape device or a remote tape device. |
ufsdump |
Chapter 24, Backing Up UFS Files and File Systems (Tasks) or Chapter 27, UFS Backup and Restore Commands (Reference) |
Create read-only copies of file systems. |
fssnap | |
Back up all file systems for systems on a network from a backup server. |
Solstice Backup software |
Solstice Backup 6.1 Administration Guide |
Back up and restore an NIS+ master server. |
nisbackup and nisrestore |
System Administration Guide: Naming and Directory Services (NIS+) |
Copy, list, and retrieve files on a tape or diskette. |
tar, cpio, or pax | |
Copy the master disk to a clone disk. |
dd | |
Restore complete file systems or individual files from removable media to a working directory. |
ufsrestore |
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 the following types of problems:
System crashes
Accidental deletion of files
Hardware failures
Natural disasters such as fire, hurricanes, or earthquakes
Problems when you reinstall or upgrade a system
You should back up all file systems that are critical to users, including file systems that change frequently. The following tables provide general guidelines on the file systems to back up for stand-alone systems and servers.
Table 23–2 File Systems to Back Up for Stand-alone Systems
File System to Back Up |
Description |
Back Up Interval |
---|---|---|
root (/) – slice 0 |
This file system contains the kernel and possibly the /var directory. The /var directory contains temporary files, logging files, or status files, and possibly contains frequently updated system accounting and mail files. |
At regular intervals such as weekly or daily |
/usr – slice 6, /opt |
The /usr and /opt file systems contain software and executables. The /opt directory is either part of root (/) or is its own file system. |
Occasionally |
/export/home – slice 7 |
This file system can contain the directories and subdirectories of all users on the stand-alone system. |
More often than root (/) or /usr, perhaps as often as once a day, depending on your site's needs |
/export, /var, or other file systems |
The /export file system can contain the kernel and executables for diskless clients. The /var directory contains temporary files, logging files, or status files. |
As your site requires |
Table 23–3 UFS File Systems to Back Up for Servers
File System to Back Up |
Description |
Back Up Interval |
---|---|---|
root (/) – slice 0 |
This file system contains the kernel and executables. |
Once a day to once a month depending on your site's needs. If you frequently add and remove users and systems on the network, you have to change configuration files in this file system. In this case, you should do a full backup of the root (/) file system at intervals between once a week and once a month. If your site keeps user mail in the /var/mail directory on a mail server, which client systems then mount, you might want to back up root (/) daily. Or, backup the /var directory, if it is a separate file system. |
/export – slice 3 |
This file system can contain the kernel and executables for diskless clients. |
Once a day to once a month, depending on your site's needs. Because the information in this file system is similar to the server's root directory in slice 0, the file system does not change frequently. You need to back up this file system only occasionally, unless your site delivers mail to client systems. Then, you should back up /export more frequently. |
/usr – slice 6, /opt |
The /usr and /opt file systems contain software and executables. The /opt directory is either part of root (/) or is its own file system. |
Once a day to once a month, depending on your site's needs. These file systems are fairly static unless software is added or removed frequently. |
/export/home – slice 7 |
This file system can contains the home directories of all the users on the system. The files in this file system are volatile. |
Once a day to once a week. |
You can perform full or incremental backups by using the ufsdump command. You can create a temporary image of a file system by using the fssnap command. The following table lists the differences between these types of backup procedures.
Table 23–4 Differences Between Types of Backups
The following table shows typical tape devices that are used for storing file systems during the backup process. The storage capacity depends on the type of drive and the data being written to the tape. For more information on tape devices, see Chapter 29, Managing Tape Drives (Tasks).
Table 23–5 Typical Media for Backing Up File Systems
Backup Media |
Storage Capacity |
---|---|
1/2-inch reel tape |
140 MB (6250 bpi) |
2.5-GB 1/4-inch cartridge (QIC) tape |
2.5 GB |
DDS3 4-mm cartridge tape (DAT) |
12–24 GB |
14-GB 8-mm cartridge tape |
14 GB |
DLT 7000 1/2-inch cartridge tape |
35–70 GB |
Use this task map to identify all the tasks for backing up and restoring file systems. Each task points to a series of additional tasks, such as determining the type of backup to perform.
Task |
Description |
For Instructions |
---|---|---|
1. Identify the file systems to back up. |
Identify which file systems need to be backed up on a daily, weekly, or monthly basis. | |
2. Determine the type of backup. |
Determine the type of backup you need for the file systems at your site. | |
3. Create the backup. |
Use one of the following methods: |
|
|
If you want to have full and incremental backups of your file systems, use the ufsdump command. | |
|
If you want to create a snapshot of a file system while it is active and mounted, consider using the fssnap command. | |
|
If you just want to have full backups of your personal home directory or smaller, less-important file systems, use the tar, cpio, or pax commands. | |
4. (Optional) Restore a file system. |
Select the restoration method that is based on the command used to back up the files or file system: |
|
|
Restore a file system backup that was created with the ufsdump command. | |
|
Restore a file system that was created with the tar, cpio, or pax command. | |
5. (Optional) Restore the root (/) or /usr file system. |
Restoring the root (/) or /usr file system is more complicated than restoring a noncritical file system. You need to boot from a local Solaris DVD or from the network while these file systems are being restored. |
A backup schedule is the schedule that you establish to run the ufsdump command. This section identifies considerations to think about when you create a backup schedule. This section also includes sample backup schedules.
The backup schedule that you create depends on the following:
Your need to minimize the number of tapes that are used for backups
The time available for doing backups
The time available for doing a full restore of a damaged file system
The time available for retrieving individual files that are accidentally deleted
If you do not need to minimize time requirements and the number of media that is used for backups, you can do full backups every day. However, this backup method is not realistic for most sites, so incremental backups are used most often. In this case, you should back up your site enough to so that you can restore files from the last four weeks. This schedule requires at least four sets of tapes, one set for each week. You would then reuse the tapes each month. In addition, you should archive the monthly backups for at least a year. Then, keep yearly backups for a number of years.
The following table describes backup interval terms and definitions.
The following table provides guidelines for scheduling backups. For additional backup schedule considerations, see Considerations for Scheduling Backups.
Table 23–6 Guidelines for Backup Schedules
File Restoration Need |
Backup Interval |
Comments |
---|---|---|
To restore different versions of files (for example, file systems that are used for word processing) |
Do daily incremental backups every working day. Do not reuse the same tape for daily incremental backups. |
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 lower level. However, with this schedule, you should use a different tape each day because you might otherwise be unable to restore the needed version of the file. For example, a file that changed on Tuesday, and again on Thursday, goes onto Friday's lower-level backup appearing as 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. |
To quickly restore a complete file system |
Do lower-level backups more frequently. |
— |
To back up a number of file systems on the same server |
Consider staggering the schedule for different file systems. |
This way you're not doing all level 0 backups on the same day. |
To minimize the number of tapes used |
Increase the level of incremental backups that are done across the week. |
Only changes from day to day are saved on each daily tape. |
|
Increase the level of backups that are done at the end of the week. Put each day's and week's incremental backups onto the same tape. |
Only changes from week to week (rather than the entire month) are saved on the weekly tapes. |
|
Put each day's and week's incremental backups onto the same tape. |
To do so, use the no rewind option of the ufsdump command, such as specifying /dev/rmt/0n. |
The dump level you specify in the ufsdump command (0–9) determines which files are backed up. Dump level 0 creates a full backup. Levels 1–9 are used to schedule incremental backups, but have no defined meanings. Levels 1–9 are just a range of numbers that are 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. A lower dump number always restarts a full or a cumulative backup. The following examples show the flexibility of the incremental dump procedure using levels 1–9.
Doing daily, cumulative incremental backups is the most commonly used backup schedule and is recommended for most situations. The following example shows a schedule that uses a level 9 dump Monday through Thursday, and a level 5 dump on Friday restarts process.
In the preceding example, you could have used other numbers in the 1–9 range to produce the same results. The key is using the same number Monday through Thursday, with any lower number on Friday. For example, you could have specified levels 4, 4, 4, 4, 2 or 7, 7, 7, 7, 5.
The following example shows a schedule where you capture only a day's work on different tapes. This type of backup is referred to as a daily, incremental backup. In this case, sequential dump level numbers are used during the week (3, 4, 5, 6) with a lower number (2) on Friday. The lower number on Friday restarts the processing.
In the preceding example, you could have used the sequence 6, 7, 8, 9 followed by 2, or 5, 6, 7, 8 followed by 3. Remember, the numbers themselves have no defined meaning. You attribute meaning by ordering them in a specified sequence, as described in the examples.
This section provides sample backup schedules. All schedules assume that you begin with a full backup (dump level 0), and that you use the -u option to record each backup in the /etc/dumpdates file.
Table 23–7 shows the most commonly used incremental backup schedule. This schedule is recommended for most situations. With this schedule, the following occurs:
Each day, all files that have changed since the lower-level backup at the end of the previous week are saved.
For each weekday level 9 backup, the previous level 0 or level 5 backup is the closest backup at a lower level. Therefore, each weekday tape contains all the files that changed since the end of the previous week or the initial level 0 backup for the first week.
For each Friday level 5 backup, the closest lower-level backup is the level 0 backup done at the beginning of the month. Therefore, each Friday's tape contains all the files changed during the month up to that point.
Floating |
Mon |
Tues |
Wed |
Thurs |
Fri |
|
---|---|---|---|---|---|---|
1st of Month |
0 |
|
|
|
|
|
Week 1 |
9 |
9 |
9 |
9 |
5 |
|
Week 2 |
9 |
9 |
9 |
9 |
5 |
|
Week 3 |
9 |
9 |
9 |
9 |
5 |
|
Week 4 |
9 |
9 |
9 |
9 |
5 |
The following table shows how the contents of the tapes can change across two weeks with the daily cumulative, weekly cumulative schedule. Each letter represents a different file.
Table 23–8 Contents of Tapes for Daily Cumulative/Weekly Cumulative Backup Schedule
Mon |
Tues |
Wed |
Thurs |
Fri |
|
---|---|---|---|---|---|
Week 1 |
a b |
a b c |
a b c d |
a b c d e |
a b c d e f |
Week 2 |
g |
g h |
g h i |
g h i j |
a b c d e f g h i j k |
With this schedule, you need six tapes if you want to reuse daily tapes. However, you need nine tapes if you want to use four different daily tapes:
One tape for the level 0 backup
Four tapes for Fridays
One or four daily tapes
If you need to restore a complete file system, you need the following tapes:
The level 0 tape
The most recent Friday tape
The most recent daily tape since the last Friday tape, if any
The following table shows a schedule where each weekday tape accumulates all files that changed since the beginning of the week, or the initial level 0 backup for the first week. In addition, each Friday's tape contains all the files that changed that week.
Table 23–9 Daily Cumulative, Weekly Incremental Backup Schedule
Floating |
Mon |
Tues |
Wed |
Thurs |
Fri |
|
---|---|---|---|---|---|---|
1st of Month |
0 |
|
|
|
|
|
Week 1 |
9 |
9 |
9 |
9 |
3 |
|
Week 2 |
9 |
9 |
9 |
9 |
4 |
|
Week 3 |
9 |
9 |
9 |
9 |
5 |
|
Week 4 |
9 |
9 |
9 |
9 |
6 |
The following table shows how the contents of the tapes can change across two weeks with the daily cumulative, weekly incremental backup schedule. Each letter represents a different file.
Table 23–10 Contents of Tapes for Daily Cumulative, Weekly Incremental Backup Schedule
Mon |
Tues |
Wed |
Thurs |
Fri |
|
---|---|---|---|---|---|
Week 1 |
a b |
a b c |
a b c d |
a b c d e |
a b c d e f |
Week 2 |
g |
g h |
g h i |
g h i j |
g h i j k |
With this schedule, you need six tapes if you want to reuse daily tapes. However, you need nine tapes if you want to use four different daily tapes:
One tape for the level 0 backup
Four tapes for Fridays
One or four daily tapes
If you need to restore a complete file system, you need the following tapes:
The level 0 tape
All the Friday tapes
The most recent daily tape since the last Friday tape, if any
The following table shows a schedule where each weekday tape contains only the files that changed since the previous day. In addition, each Friday's tape contains all files changed since the initial level 0 backup at the beginning of the month.
Table 23–11 Daily Incremental, Weekly Cumulative Backup Schedule
Floating |
Mon |
Tues |
Wed |
Thurs |
Fri |
|
---|---|---|---|---|---|---|
1st of Month |
0 |
|
|
|
|
|
Week 1 |
3 |
4 |
5 |
6 |
2 |
|
Week 2 |
3 |
4 |
5 |
6 |
2 |
|
Week 3 |
3 |
4 |
5 |
6 |
2 |
|
Week 4 |
3 |
4 |
5 |
6 |
2 |
The following table shows how the contents of the tapes can change across two weeks with the daily incremental, weekly cumulative schedule. Each letter represents a different file.
Table 23–12 Contents of Tapes for Daily Incremental, Weekly Cumulative Backup Schedule
Mon |
Tues |
Wed |
Thurs |
Fri |
|
---|---|---|---|---|---|
Week 1 |
a b |
c d |
e f g |
hi |
a b c d e f g h i |
Week 2
|
j k l |
m |
n o |
p q |
a b c d e f g h i j k l m n o p q r s |
With this schedule, you need at least 9 tapes if you want to reuse daily tapes, which is not recommended. Preferably, you need 21 tapes if you save weekly tapes for a month: one tape for the level 0, 4 tapes for the Fridays, and 4 or 16 daily tapes.
1 tape for the level 0 backup
4 tapes for all the Friday backups
4 or 16 daily tapes
If you need to restore the complete file system, you need the following tapes:
The level 0 tape
The most recent Friday tape
All the daily tapes since the last Friday tape, if any
The following table 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. This example assumes that the backup period begins on a Sunday and consists of four seven-day weeks.
Table 23–13 Example of Monthly Backup Schedule for a Server
Directory |
Date |
Dump Level |
Tape Name |
---|---|---|---|
root (/) |
1st Sunday |
0 |
n tapes |
/usr |
1st Sunday |
0 |
n tapes |
/export |
1st Sunday |
0 |
n tapes |
/export/home |
1st Sunday |
0 |
n tapes |
|
1st Monday |
9 |
A |
|
1st Tuesday |
9 |
B |
|
1st Wednesday |
5 |
C |
|
1st Thursday |
9 |
D |
|
1st Friday |
9 |
E |
|
1st Saturday |
5 |
F |
root (/) |
2nd Sunday |
0 |
n tapes |
/usr |
2nd Sunday |
0 |
n tapes |
/export |
2nd Sunday |
0 |
n tapes |
/export/home |
2nd Sunday |
0 |
n tapes |
|
2nd Monday |
9 |
G |
|
2nd Tuesday |
9 |
H |
|
2nd Wednesday |
5 |
I |
|
2nd Thursday |
9 |
J |
|
2nd Friday |
9 |
K |
|
2nd Saturday |
5 |
L |
root (/) |
3rd Sunday |
0 |
n tapes |
/usr |
3rd Sunday |
0 |
n tapes |
/export |
3rd Sunday |
0 |
n tapes |
/export/home |
3rd Sunday |
0 |
n tapes |
|
3rd Monday |
9 |
M |
|
3rd Tuesday |
9 |
N |
|
3rd Wednesday |
5 |
O |
|
3rd Thursday |
9 |
P |
|
3rd Friday |
9 |
Q |
|
3rd Saturday |
5 |
R |
root (/) |
4th Sunday |
0 |
n tapes |
/usr |
4th Sunday |
0 |
n tapes |
/export |
4th Sunday |
0 |
n tapes |
/export/home |
4th Sunday |
0 |
n tapes |
|
4th Monday |
9 |
S |
|
4th Tuesday |
9 |
T |
|
4th Wednesday |
5 |
U |
|
4th Thursday |
9 |
V |
|
4th Friday |
9 |
W |
|
4th Saturday |
5 |
X |
With this schedule, you use 4n tapes, the number of tapes needed for 4 full backups of the root (/), /usr, /export, and /export/home file systems. Also, you need 24 additional tapes for the incremental backups of the /export/home file systems. This schedule assumes that each incremental backup uses one tape and that you save the tapes for a month.
Here's how this schedule works:
On each Sunday, do a full backup (level 0) of the root (/), /usr, /export, and /export/home file systems. Save the level 0 tapes for at least three months.
On the first Monday of the month, use tape A to do a level 9 backup of the /export/home file system. The ufsdump command copies all files changed since the previous lower-level backup. In this case, the previous lower-level backup is the level 0 backup that you did on Sunday.
On the first Tuesday of the month, use tape B to do a level 9 backup of the /export/home file system. Again, the ufsdump command copies all files changed since the last lower-level backup, which is Sunday's level 0 backup.
On the first Wednesday of the month, use tape C to do a level 5 backup of the /export/home file system. The ufsdump command copies all files that changed since Sunday.
Do the Thursday and Friday level 9 backups of the /export/home file system on tapes D and E. The ufsdump command copies all files that changed since the last lower-level backup, which is Wednesday's level 5 backup.
On the first Saturday of the month, use tape F to do a level 5 backup of /export/home. The ufsdump command 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 four-week period, when you use them again.
Repeat steps 1–6 for the next three weeks, using tapes G–L and 4n tapes for the level 0 backup on Sunday, and so on.
For each four-week period, repeat steps 1–7, using a new set of tapes for the level 0 backups and reusing tapes A–X for the incremental backups. The level 0 tapes could be reused after three months.
This schedule lets you save files in their various states for a month. This plan 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.