This chapter provides guidelines and planning information on backing up and restoring complete file systems using the ufsdump and ufsrestore commands.
Here is a list of concept information in this chapter.
Use Chapter 43, Backing Up Files and File Systems (Tasks) and Chapter 44, Restoring Files and File Systems (Tasks) to find step-by-step instructions for backing up and restoring file systems (using the ufsdump and ufsrestore 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 commands for scheduled backup and restore operations (ufsdump and ufsrestore); however, other commands are available for copying files and file systems for sharing or transporting files. The table below provides pointers to all commands that copy individual files and/or file systems to media.
Table 42-1 Commands for Copying Files and File Systems
If You Want To ... |
Then Use ... |
And Go To ... |
---|---|---|
Back up complete or individual file systems to a local or remote tape device |
ufsdump(1M) command |
Chapter 43, Backing Up Files and File Systems (Tasks) or Chapter 45, The ufsdump and ufsrestore Commands (Reference) |
Back up complete file systems for all systems on a network from a server |
Solstice BackupTM software | |
Back up and restore a NIS+ master server |
nisbackup(1M) and nisrestore(1M) commands | |
Copy, list, and retrieve files on tape Copy, list, and retrieve files on diskette |
tar(1), cpio(1), or pax(1) command tar(1) command | |
Copy master disk to a clone disk |
dd(1M) command | |
Restore complete file systems or individual files from removable media to a working directory |
ufsrestore(1M) command |
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, earthquakes)
Problems when reinstalling or upgrading a system
The table below shows typical tape devices used for storing file systems during the backup process. Capacity depends on the type of drive and the data being written to the tape. For more detailed information on tape devices, see Chapter 47, Managing Tape Drives (Tasks).
Table 42-2 Typical Media for Backing Up File Systems
Media |
Capacity |
---|---|
1/2-inch reel tape |
140 Mbytes (6250 bpi) |
2.5-Gbyte 1/4 inch cartridge (QIC) tape |
2.5 Gbytes |
DDS3 4-mm cartridge tape (DAT) |
12 - 24 Gbytes |
14-Gbyte 8-mm cartridge tape |
14 Gbytes |
DLTTM 7000 1/2-inch cartridge tape |
35 - 70 Gbytes |
You should back up all file systems that are critical to users, including file systems that change frequently. The tables below provide general guidelines on the file systems to back up for standalone systems and servers.
Table 42-3 File Systems to Back Up for Standalone Systems
Consider Backing Up These File Systems ... |
Because ... |
And At This Interval ... |
---|---|---|
root (/) - partition 0 |
The root (/) file system contains the kernel and might contain the /var directory in which frequently modified files such as mail and accounting are kept. |
At regular intervals. |
/usr - partition 6, /opt |
Installing new software and adding new commands typically affects the /usr and /opt file systems. /opt is either part of root (/) or is its own file system. |
Occasionally. |
/export/home |
The /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 systems |
During installation of Solaris software, you might have created these file systems. |
As your site requires. |
Table 42-4 File Systems to Back Up for Servers
Consider Backing Up These 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's 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 backup 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 might want to back up root (/) daily (or /var, if it is a separate file system). /export - the root (/) directory of 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 delivers mail to client systems; then you should back up /export more frequently. /usr and /opt - contents are fairly static and need to be backed up 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. |
You do not need to back up a server's /export/swap file system.
The ufsdump and ufsrestore commands are the recommended commands for scheduled backups of complete file systems. The table below lists the tasks you can perform with them. For information on how these commands work and their syntax, see Chapter 45, The ufsdump and ufsrestore Commands (Reference).
Table 42-5 Tasks You Can Perform With the ufsdump and ufsrestore Commands
With This Command ... |
You Can ... |
Comments |
---|---|---|
ufsdump |
Back up complete or partial file systems to local or remote tape drives |
The 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 interface. |
|
Back up incremental file system changes |
This 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 system
|
You 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 or a file. |
|
Automate backups
|
Use the crontab utility to run a script that starts the ufsdump command. |
|
Restrict user access to backup tables |
Use the -a option. |
|
Determine the size of a backup without actually doing the backup |
Use the -S option. |
|
Keep a log of when each file system was backed up |
Use the -u option. |
|
Verify the contents of the tape against the source file system |
Use the -v option. |
ufsrestore |
Restore individual or complete file systems from a local or remote tape drive |
|
With the ufsdump command, you can perform full or incremental backups. The table below lists the differences between these types of backup procedures.
Table 42-6 Differences Between Full and Incremental 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.
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 are accidentally deleted
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 most sites, so incremental backups are used most often. In this case, you should back up your site enough to restore files from the last four weeks. This requires at least four sets of tapes--one for each week, which you would reuse each month. In addition, you should archive the monthly backups for at least a year, and then keep yearly backups for a number of years.
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.
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.
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.
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 (2) on Friday.
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 numbers themselves have no defined meaning; you attribute meaning by ordering them in a high/low sequence.
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.
The table below shows the most commonly used incremental backup schedule; it is recommended for most situations. With this schedule:
All files that have changed since the lower-level backup at the end of the previous week are saved each day.
For each weekday level 9 backup, the previous level 0 or level 5 is the closest backup at a lower level. Therefore, each weekday tape contains all the files changed since the end of the previous week (or the initial level 0 for the first week).
For each Friday level 5 backup, 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.
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 table below shows how the contents of the tapes can change across two weeks using the previous schedule. Each letter represents a different file.
Table 42-8 Contents of Tapes for Daily/Weekly Cumulative 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), 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 the following tapes: the level 0, the most recent Friday tape, and the most recent daily tape since the last Friday tape (if any).
The table below 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 42-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 table below shows how the contents of the tapes can change across two weeks using the previous schedule. Each letter represents a different file.
Table 42-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), 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 need the following tapes: the level 0, all the Friday tapes, and the most recent daily tape since the last Friday tape (if any).
The table below 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 42-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 table below shows how the contents of the tapes can change across two weeks using the previous schedule. Each letter represents a different file.
Table 42-12 Contents of Tapes for Daily/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 nine tapes (if you want to reuse daily tapes--not recommended), or 21 tapes (if you save weekly tapes for a month): one for the level 0, four for the Fridays, and four or 16 daily tapes.
If you need to restore the complete file system, you need the following tapes: the level 0, the most recent Friday tape, and all the daily tapes since the last Friday tape (if any).
The table below 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 42-13 Schedule of Backups for a Server Example
Directory |
Date |
Level |
Tape Name |
---|---|---|---|
root (/) |
1st Sunday |
0 |
n tapes |
/usr |
1st Sunday |
0 |
" |
/export |
1st Sunday |
0 |
" |
/export/home |
1st Sunday |
0 |
" |
|
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 |
" |
/export |
2nd Sunday |
0 |
" |
/export/home |
2nd Sunday |
0 |
" |
|
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 |
" |
/export |
3rd Sunday |
0 |
" |
/export/home |
3rd Sunday |
0 |
" |
|
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 |
" |
/export |
4th Sunday |
0 |
" |
/export/home |
4th Sunday |
0 |
" |
|
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 plan, you use 4n tapes (the number of tapes needed for four full backups of root (/), /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:
On each Sunday, do a full backup (level 0) of root (/), /usr, /export, and /export/home. Save the level 0 tapes for at least 3 months.
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).
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.
On the first Wednesday, use tape C to do a level 5 backup. ufsdump copies all files changed since Sunday.
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.
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.
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.
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.
The table below provides other suggestions for scheduling backups.
Table 42-14 Other Suggestions for Scheduling Backing Up Systems