Sun Microsystems System Administration Guide, Volume 1 (2000) - page 18

 

  Index      Manuals     Sun Microsystems System Administration Guide, Volume 1 (2000)

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     16      17      18      19     ..

 

 

 

Sun Microsystems System Administration Guide, Volume 1 (2000) - page 18

 

 

TABLE 42-8
Contents of Tapes for Daily/Weekly Cumulative Schedule
Mon
Tues
Wed
Thurs
Fri
Week 1
a b
abc
abc d
ab cde
abc de f
g
gh
ghi
gh ij
abc de fg hij
Week 2
k
Tape Requirements
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).
Example—Daily Cumulative, Weekly Incremental
Backups
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
Backing Up and Restoring File Systems (Overview)
563
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
ab c
a bcd
abc de
abc de f
Week 2
g
gh
g hi
ghij
ghijk
Tape Requirements
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).
Example—Daily Incremental, Weekly Cumulative
Backups
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
564
TABLE 42-11
Daily Incremental/Weekly Cumulative Backup Schedule
(continued)
Floating
Mon
Tues
Wed
Thurs
Fri
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
ab
cd
e f g
hi
abc de fgh i
jkl
m
n o
pq
abc de fgh ij
Week 2
klm nopq rs
Tape Requirements
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).
Example—Backup Schedule for a Server
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.
Backing Up and Restoring File Systems (Overview)
565
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
"
1st Sunday
0
"
/export
1st Sunday
0
"
/export/home
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
2nd Sunday
0
"
/usr
2nd Sunday
0
"
/export
/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
566
TABLE 42-13
Schedule of Backups for a Server Example
(continued)
Directory
Date
Level
Tape Name
/usr
3rd Sunday
0
"
/export
3rd Sunday
0
"
3rd Sunday
0
"
/export/home
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
4th Sunday
0
"
/usr
4th Sunday
0
"
/export
/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
Backing Up and Restoring File Systems (Overview)
567
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 root (/), /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 Suggestions
The table below provides other suggestions for scheduling backups.
568
TABLE 42-14
Other Suggestions for Scheduling Backing Up Systems
If You ...
Then ...
Comments
Do daily incremental
Need to restore different
This schedule saves all files
backups every
versions of files (for
modified that day, as well as those
example, file systems
working day.
files still on disk that were
Do not reuse the same
used for word processing)
modified since the last backup of a
tape for daily
lower level. However, with this
incremental backups.
schedule you should use a
different tape 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
Do lower-level backups
complete file system
more frequently.
Are backing up a number
Consider offsetting the
This way you’re not doing all level
of file systems on the
schedule for different file
0 backups on the same day.
same server
systems.
Need to minimize tapes
Increase the level of
This means only changes from day
incremental backups
to day are saved on each daily tape.
done across the week.
Increase the level of
This means only changes from
backups done at the end
week to week (rather than the
of the week.
entire month) are saved on the
weekly tapes.
Put each day’s and week’s
This is done by using the no
incremental backups onto
rewind option in the ufsdump
the same tape.
command.
Backing Up and Restoring File Systems (Overview)
569
570
CHAPTER
43
Backing Up Files and File Systems
(Tasks)
This chapter describes the procedures for backing up file systems using the ufsdump
command.
This is a list of the step-by-step instructions in this chapter.
“How to Find File System Names” on page 572
“How to Determine the Number of Tapes for a Full Backup” on page 572
“How to Do Backups to Tape” on page 574
For detailed information on syntax, options, and arguments for the ufsdump
command, see Chapter 45.
Preparing to Do Backups
Preparing to back up file systems begins with planning, which is described in
Chapter 42 and includes choosing:
A tape drive
The file systems to back up
The type of backup (full or incremental)
A backup schedule
This section describes other tasks you might need to perform before backing up file
systems, including:
Finding names of file systems to back up
Determining the number of tapes for a full backup
571
How to Find File System Names
1. Display the contents of the /etc/vfstab file.
$ more /etc/vfstab
2. Look in the mount point column for the name of the file system.
3. You use the mount point in the mount point column when you back up the
file system.
Example—Finding File System Names
$ more /etc/vfstab
#device
device
mount
FS
fsck mount mount
#to mount
to fsck
point
type pass at boot options
#
#/dev/dsk/c1d0s2
/dev/rdsk/c1d0s2
/usr
ufs
1
yes
-
fd
-
/dev/fd
fd
-
no
-
/proc
-
/proc
proc
-
no
-
/dev/dsk/c0t0d0s1 -
-
swap
-
no
-
/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 /
ufs
1
no
-
/dev/dsk/c0t0d0s6 /dev/rdsk/c0t0d0s6 /usr
ufs
1
no
-
/dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export/home ufs
2
yes
-
mars:/share/kit
-
/kit
nfs
-
yes
-
mars:/db/doc
-
/db/doc
nfs
-
yes
-
How to Determine the Number of Tapes for a Full
Backup
1. Become superuser.
2. Estimate the size of the backup in bytes by using the usfdump S command.
# ufsdump S filesystem
S
Displays the estimated number of bytes needed to do the backup.
3. Divide the estimated size by the capacity of the tape to see how many tapes
you need.
572
See Table 42-2 for a list of tape capacities.
Example—Determining Number of Tapes
In this example, the file system of 489,472 bytes will easily fit on a 150-Mbyte tape.
# ufsdump S /export/home
489472
Doing Backups
The following are general guidelines for performing backups:
Use single-user mode or unmount the file system.
Be aware that backing up file systems when there are directory-level operations
(such as creating, removing, and renaming files) and file-level activity occurring
means that some data will not be included in the backup.
You can run the ufsdump command from a single system and remotely back up
groups of systems across the network through remote shell or remote login, and
direct the output to the system on which the tape drive is located. (Typically, the
tape drive is located on the system from which you run the ufsdump command,
but it does not have to be.)
Another way to back up files to a remote drive is to pipe the output from the
ufsdump command to the dd command. See Chapter 46 for information about
using the dd command.
If you are doing remote backups across the network, the system with the tape
drive must have entries in its /.rhosts file for each client that will be using the
drive. Also, the system initiating the backup must be included in the /.rhosts
file on each system it will back up.
To specify a remote drive on a system, use the naming convention that matches
the OS release of the system with the remote tape drive. For example, use
/dev/rst0 for a remote drive on a system running the SunOS 4.1.1 release or
compatible versions; use /dev/rmt/0 for a system running the Solaris 8 release
or compatible versions.
Note - Use the nisbackup command to back up a NIS+ master server running the
Solaris 2.5 release or compatible versions. See Solaris Naming Administration Guide
for information on using this command.
Backing Up Files and File Systems (Tasks)
573
How to Do Backups to Tape
The following steps provide the general steps for backing up file systems using the
ufsdump command. The examples show specific uses of options and arguments.
1. Become superuser.
2. Bring the system to run level S (single-user mode).
# shutdown -g30 -y
3.
[Optional] Check the file system for consistency with the fsck command.
Running the fsck -m command checks for consistency of file systems. For
example, power failures can leave files in an inconsistent state. For more
information on the fsck command, see Chapter 39.
# fsck -m /dev/rdsk/ device-name
4. If you need to back up file systems to a remote tape drive:
a. On the system to which the tape drive is attached (the tape server), add the
following entry to its /.rhosts file.
host root
host
Specifies the name of the system on which you will run ufsdump
to perform the backup.
b. On the tape server, verify that the host added to the /.rhosts file is
accessible through the name service.
5. Identify the device name of the tape drive.
The default tape drive is /dev/rmt/0.
6. Insert a tape that is not write protected into the tape drive.
7. Back up file systems using the ufsdump command.
Use the following table to select the most common options and arguments for the
ufsdump command. See Chapter 45 for other options and arguments.
574
Use This Option or
To ...
Argument ...
For Example ...
See ...
Do a full
0 option
ufsdump 0ucf /dev/rmt/0 /
“Example—Full
backup
Backup, root (/)” on
page 576
Do an
1-9 option
ufsdump 9ucf /dev/rmt/0 /
“Example—Incremental
incremental
Backup, root (/) ” on
backup
page 576
Back up
Specify a file or
ufsdump ucf /dev/rmt/0 /export/
individual files
directory
home/kryten
Record dumps
ufsdump 9ucf /dev/rmt/0 /export/
u option
“Example—Incremental
to /etc/
home
Backup, root (/) ” on
dumpdates
page 576
file
Specify a
ufsdump 9ucf /dev/rmt/0 /export/
c option
“Example—Incremental
cartridge tape
home
Backup, root (/) ” on
page 576
Specify the
ufsdump 9ucf /dev/rmt/0 /export/
f dump-file
“Example—Incremental
tape drive
home
Backup, root (/) ” on
page 576
Back up local
remote-system:dump-
ufsdump 0ucf pluto:/dev/rmt/0 /
“Example—Full
file systems to
file
export/home
Backup to Remote
a remote
System (Solaris 8 Data
system’s tape
to Solaris 8 System)”
device
on page 578
8. If prompted, remove the tape and replace with the next volume.
9. Label each tape with the volume number, level, date, system name, disk slice,
and file system.
10. Bring the system back to run level 3 by pressing Control-d.
11. Verify the backup was successful by using the ufsrestore command to
display the tape contents.
This command is described in Chapter 44.
Backing Up Files and File Systems (Tasks)
575
Example—Full Backup, root (/)
The following example shows a full backup of the root (/) file system to a QIC-150
tape (/dev/rmt/0).
#
shutdown -g30 -y
#
ufsdump 0ucf /dev/rmt/0 /
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 0 dump: Tue Jul 13 10:46:09 1999
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c0t0d0s0 (starbug:/) to /dev/rmt/0.
DUMP: Mapping (Pass I) [regular files]
DUMP: Mapping (Pass II) [directories]
DUMP: Estimated 71058 blocks (34.70MB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: Tape rewinding
DUMP: 70936 blocks (34.64MB) on 1 volume at 64 KB/sec
DUMP: DUMP IS DONE
DUMP: Level 0 dump on Tue Jul 13 10:46:09 1999
# ufsrestore tf /dev/rmt/0
2
3
./lost+found
5696
./usr
11392
./var
17088
./export
22784
./export/home
28480
./opt
5697
./etc
11393
./etc/default
11394
./etc/default/sys-suspend
11429
./etc/default/cron
11430
./etc/default/devfsadm
11431
./etc/default/dhcpagent
11432
./etc/default/fs
11433
./etc/default/inetinit
11434
./etc/default/kbd
11435
./etc/default/nfslogd
11436
./etc/default/passwd
# (Press Control-d to bring system to run level 3)
Example—Incremental Backup, root (/)
The following example shows an incremental backup of the root (/) file system to a
4-mm DAT tape (/dev/rmt/0).
# ufsdump 9ucf /dev/rmt/0 /
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 9 dump: Tue Jul 13 10:58:12 1999
DUMP: Date of last level 0 dump: Tue Jul 13 10:46:09 1999
DUMP: Dumping /dev/rdsk/c0t0d0s0 (starbug:/) to /dev/rmt/0.
DUMP: Mapping (Pass I) [regular files]
576
(Continuation)
DUMP: Mapping (Pass II) [directories]
DUMP: Mapping (Pass II) [directories]
DUMP: Mapping (Pass II) [directories]
DUMP: Mapping (Pass II) [directories]
DUMP: Estimated 200 blocks (100KB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: Tape rewinding
DUMP: 124 blocks (62KB) on 1 volume at 8 KB/sec
DUMP: DUMP IS DONE
DUMP: Level 9 dump on Tue Jul 13 10:58:12 1999
#
ufsrestore tf /dev/rmt/0
2
3
./lost+found
5696
./usr
11392
./var
17088
./export
22784
./export/home
28480
./opt
5697
./etc
11393
./etc/default
11394
./etc/default/sys-suspend
11429
./etc/default/cron
11430
./etc/default/devfsadm
11431
./etc/default/dhcpagent
11432
./etc/default/fs
11433
./etc/default/inetinit
11434
./etc/default/kbd
11435
./etc/default/nfslogd
11436
./etc/default/passwd
11437
./etc/default/tar
Example—Full Backup, Individual Home Directory
The following example shows a full backup of the /export/home/kryten
directory to a 4-mm DAT tape.
# ufsdump 0ucf /dev/rmt/0 /export/home/kryten
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 0 dump: Tue Jul 13 11:30:45 1999
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c0t3d0s7 (pluto:/export/home) to /dev/rmt/0.
DUMP: Mapping (Pass I) [regular files]
DUMP: Mapping (Pass II) [directories]
DUMP: Estimated 232 blocks (116KB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
(continued)
Backing Up Files and File Systems (Tasks)
577
(Continuation)
DUMP: Tape rewinding
DUMP: 124 blocks (62KB) on 1 volume at 8 KB/sec
DUMP: DUMP IS DONE
# ufsrestore tf /dev/rmt/0
2
2688
./kryten
5409
./kryten/letters
5410
./kryten/letters/letter1
5411
./kryten/letters/letter2
5412
./kryten/letters/letter3
2689
./kryten/.profile
8096
./kryten/memos
30
./kryten/reports
31
./kryten/reports/reportA
32
./kryten/reports/reportB
33
./kryten/reports/reportC
#
Example—Full Backup to Remote System (Solaris 8 Data to
Solaris 8 System)
The following example shows a full backup of a local /export/home file system on
a Solaris 8 system to a tape device on a remote Solaris 8 system called starbug.
# ufsdump 0ucf starbug:/dev/rmt/0 /export/home
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 0 dump: Tue Jul 13 13:14:40 1999
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c0t3d0s7 (mars:/export/home) to starbug:/dev/rmt/0
DUMP: Mapping (Pass I) [regular files]
DUMP: Mapping (Pass II) [directories]
DUMP: Estimated 476 blocks (238KB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: Tape rewinding
DUMP: 376 blocks (188KB) on 1 volume at 21 KB/sec
DUMP: DUMP IS DONE
DUMP: Level 0 dump on Tue Jul 13 13:14:40 1999
# ufsrestore tf starbug:/dev/rmt/0
2
3
./lost+found
3776
./kryten
3777
./kryten/.cshrc
3778
./kryten/.login
3779
./kryten/b
3780
./kryten/memos
7552
./kryten/letters
7553
./kryten/letters/b
7554
./kryten/letters/letter1
(continued)
578
(Continuation)
7555
./kryten/letters/letter2
7556
./kryten/letters/letter3
11328
./kryten/reports
11329
./kryten/reports/reportA
11330
./kryten/reports/reportB
11331
./kryten/reports/reportC
#
Example—Full Backup to Remote System (Solaris 8 Data to
SunOS 4.1.4 System)
The following example shows a full backup of a local /export/home file system on
a Solaris 8 system to a tape device on a remote SunOS 4.1.4 system (mars).
Note - Notice the SunOS 4.x-style device name (/dev/rst0) used with the
ufsdump command.
# ufsdump 0ucf mars:/dev/rst0 /export/home
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 0 dump: Thu Jul 15 09:13:01 1999
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c0t0d0s7 (starbug:/export/home) to
mars:/dev/
rst0.
DUMP: Mapping (Pass I) [regular files]
DUMP: Mapping (Pass II) [directories]
DUMP: Estimated 5690 blocks (2.78MB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: Tape rewinding
DUMP: 5542 blocks (2.71MB) on 1 volume at 77 KB/sec
DUMP: DUMP IS DONE
DUMP: Level 0 dump on Thu Jul 15 09:13:01 1999
# ufsrestore tf mars:/dev/rst0
2
3
./lost+found
2688
./kryten
5409
./kryten/letters
5410
./kryten/letters/letter1
5411
./kryten/letters/letter2
5412
./kryten/letters/letter3
2689
./kryten/.profile
8096
./kryten/memos
30
./kryten/reports
31
./kryten/reports/reportA
(continued)
Backing Up Files and File Systems (Tasks)
579
(Continuation)
32
./kryten/reports/reportB
33
./kryten/reports/reportC
#
Example—Full Backup to Remote System (SunOS 4.1.4 Data
to Solaris 8)
The following example shows a full backup of a local root (/) file system on a Sun
4.1.4 system (mars) to a remote tape device on a Solaris 8 system called starbug.
Note - When you back up data on a system running SunOS 4.1.4 or a compatible
version, you must use the dump command—not the ufsdump command.
# dump 0ucf starbug:/dev/rmt/0 /
DUMP: Date of this level 0 dump: Wed Jul
7 06:19:33 1999
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rsd0a (/) to /dev/rmt/0 on host starbug
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 123706 blocks (60.40MB) on 1.41 tape(s).
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: level 0 dump on Wed Jul
7 06:19:33 1999
DUMP: Tape rewinding
DUMP: 123680 blocks (60.39MB) on 2 volumes
DUMP: DUMP IS DONE
# restore tf starbug:/dev/rmt/0
2
3
./lost+found
3776
./export
7552
./home
11328
./usr
15104
./pcfs
3777
./tftpboot
3778
./tftpboot/tftpboot
3794
./tftpboot/boot.sun4c.sunos.4.1.4
7553
./etc
7554
./etc/sendmail.cf
7555
./etc/aliases
7556
./etc/aliases.dir
7557
./etc/aliases.pag
7558
./etc/holidays
7559
./etc/dumpdates
(continued)
580
(Continuation)
#
Backing Up Files and File Systems (Tasks)
581
582
CHAPTER
44
Restoring Files and File Systems (Tasks)
This chapter describes the procedures for restoring file systems.
Here is a list of step-by-step instructions in this chapter:
“How to Determine Which Tapes to Use” on page 585
“How to Restore Files Interactively” on page 587
“How to Restore Specific Files Non-Interactively” on page 589
“How to Restore Files Using a Remote Tape Drive” on page 591
“How to Restore a Complete File System” on page 592
“How to Restore the root (/) and /usr File Systems” on page 595
This chapter describes how to use the ufsrestore(1M) command to restore files
and file systems that were backed up using the ufsdump command. See Chapter 46
for information about other commands you can use to archive, restore, copy, or move
files and file systems.
Preparing to Restore Files and File
Systems
The ufsrestore command copies files to disk, relative to the current working
directory, from backups created using the ufsdump command. You can use
ufsrestore to reload an entire file system hierarchy from a level 0 dump and
incremental dumps that follow it or to restore one or more single files from any
dump tape. If ufsrestore is run as superuser, files are restored with their original
owner, last modification time, and mode (permissions).
Before you start to restore files or file systems, you need to know:
583
The tapes (or diskettes) you need
The raw device name on which you want to restore the file system
The type of tape drive you will use
The device name (local or remote) for the tape drive
Determining the Disk Device Name
If you have properly labeled your backup tapes, you should be able to use the disk
device name (/dev/rdsk/devicename) from the tape label. See “How to Find File
System Names” on page 572 for more information.
Determining the Type of Tape Drive You Need
You must use a tape drive that is compatible with the backup media to restore the
files. The format of the backup media determines which drive you must use to
restore files. For example, if your backup media is 8-mm tape, you must use an
8-mm tape drive to restore the files.
Determining the Tape Device Name
You might have specified the tape device name (/dev/rmt/n) as part of the backup
tape label information. If you are using the same drive to restore a backup tape, you
can use the device name from the label. See Chapter 47 for more information on
media devices and device names.
Restoring Complete File Systems
Occasionally, a file system becomes so damaged that you must completely restore it.
Typically, you need to restore a complete file system after a disk head crash. You
might need to replace the hardware before you can restore the software. See Chapter
30 or Chapter 31 for information on how to replace a disk. Fully restoring a file
system such as /export/home can take a lot of time. If you have consistently
backed up file systems, you can restore them to their state from the time of the last
incremental backup.
584
Restoring Individual Files and
Directories
When you back up files and directories, you save them relative to the file system in
which they belong. When you restore files and directories, ufsrestore recreates the
file hierarchy in the current working directory. For example, files backed up from the
/export/doc/books directory (where /export is the file system), would be saved
relative to /export. In other words, the book1 file in the docs directory would be
saved as ./doc/books/book1 on the tape. Later on, if you restored the
./doc/books/book1 file to the /var/tmp directory, the file would be restored to
/var/tmp/doc/books/book1.
When restoring individual files and directories, it is a good idea to restore them to a
temporary location, such as the /var/tmp directory. After you verify them, you can
move the files to their proper locations. You can restore individual files and
directories to their original locations. If you do so, be sure you are not overwriting
newer files with older versions from the backup tape.
Note - Do not restore files in the /tmp directory even temporarily. The /tmp
directory is usually mounted as a TMPFS file system and TMPFS does not support
UFS file system attributes such as ACLs.
Restoring Files and File Systems
Things you need to know:
The tapes that have the files to be restored
The path name of the files to be restored
How to Determine Which Tapes to Use
1. Ask the user the approximate date the files to be recovered were last modified.
2. Refer to your backup plan to find the date of the last backup that would have
the file or file system on it.
To retrieve the most recent version of a file, work backward through the
incremental backups from highest to lowest level and most recent to least recent,
unless the user requests otherwise.
Restoring Files and File Systems (Tasks)
585
3. If you have online archive files, use the ufsrestore command to identify
correct media.
# ufsrestore ta archive-name ./path/filename ./path/filename
t
List each file that appears on the tape.
a
Reads the table of contents from the online archive
file instead of the tape.
Identifies the online archive file name.
archive-name
./path/filename
Identifies the file name(s) you are looking for on
the online archive. If successful, ufsrestore
prints out the inode number and file name. If
unsuccessful, ufsrestore prints an error message.
4. Insert the media containing the backups in the drive and use the ufsrestore
command to verify the correct media.
# ufsrestore tf device-name ./path/filename ./path/filename
Be sure to use the complete path for the filename(s). If a file is in the backup, its
name and inode number is listed. Otherwise, a message says it is not on the
volume.
5. If you have multiple dump files on the same tape, use the s /dev/rmt/n
option to position the tape at the dump you want to use.
# ufsrestore tfs /dev/rmt/n tape_number
Example—Determining Which Tapes to Use
If you use ufsdump to dump the /usr file system, the table of contents lists only the
files and directories under /usr. The following example checks if /usr/bin/pwd is
in the online archive.
# ufsrestore ta archive-name ./bin/pwd
The following example checks if /usr/bin/pwd is on the backup tape.
# ufsrestore tf /dev/rmt/n ./bin/pwd
586
How to Restore Files Interactively
1.
Become superuser.
2.
Write-protect the tape.
3.
Insert the volume 1 tape into the tape drive.
4.
Change to a directory that will be used to restore the files temporarily.
# cd /var/tmp
To avoid conflicts with other users, you might want to create and change to a
subdirectory, such as /var/tmp/restore, in which to restore the files.
If you are restoring a hierarchy, you should restore the files in a temporary
directory on the same file system where the files will reside, so you can use the
mv command to move the entire hierarchy where it belongs after it is restored.
5.
Use the ufsrestore command to start the interactive restoration.
Some informational messages and the ufsrestore> prompt are displayed.
# ufsrestore if /dev/rmt/n
6.
Create a list of files to be restored.
a. List the contents of a directory.
ufsrestore> ls directory
b. Change to a directory.
ufsrestore> cd directory-name
c. Create a list of files and directories you want to restore.
ufsrestore> add filename filename
d. If you need to remove a directory or file name from the list of files to be
restored, use the delete command.
ufsrestore> delete filename
Restoring Files and File Systems (Tasks)
587
7.
Turn on verbose mode to display the file names as they are being restored.
ufsrestore> verbose
8.
Use the extract command after the list is complete.
ufsrestore> extract
The ufsrestore command asks you which volume number to use.
9.
Type the volume number and press Return. If you have only one volume, type
1 and press Return.
Specify next volume #: 1
The files and directories in the list are extracted and restored to the current
working directory.
10. To keep the mode of the current directory unchanged, enter n at the set
owner/mode prompt.
set owner/mode for ‘.’? [yn] n
You must wait while ufsrestore performs its final cleanup.
11. Quit the ufsrestore program.
ufsrestore> quit
You then see the shell prompt.
12. Verify the restored files.
a. List the restored files and directories.
# ls -l
A list of files and directories is appears.
b. Check the list to be sure all the files and directories you specified in the list
have been restored.
c. Move the files to the proper directories.
588
Example—Restoring Files Interactively
The following example extracts the files /etc/passwd and /etc/shadow from the
backup tape.
# cd /var/tmp
# ufsrestore if /dev/rmt/0
ufsrestore> ls
.:
.cpr_config
etc/
lost+found/
sbin/
usr/
TT_DB/
export/
mnt/
sccs/
var/
b/
home/
net/
share/
vol/
bin
kernel/
opt/
shared/
ws/
dev/
lib
platform/
src/
xfn/
devices/
license/
proc/
tmp/
ufsrestore> cd etc
ufsrestore> add passwd shadow
ufsrestore> verbose
verbose mode on
ufsrestore> extract
Extract requested files
You have not read any volumes yet.
Unless you know which volume your file(s) are on you should start
with the last volume and work towards the first.
Specify next volume #: 1
extract file ./etc/shadow
extract file ./etc/passwd
Add links
Set directory mode, owner, and times.
set owner/mode for ‘.’? [yn] n
ufsrestore> quit
#
How to Restore Specific Files Non-Interactively
1. Become superuser.
2. Write-protect the tape for safety.
3. Insert the volume 1 tape into the tape drive.
4. Change to a directory for restoring files temporarily.
# cd /var/tmp
To avoid conflicts with other users, you might want to create and change to a
subdirectory, such as /var/tmp/restore, in which to restore the files.
Restoring Files and File Systems (Tasks)
589
If you are restoring a hierarchy, you should restore the files in a temporary
directory on the same file system where the files will reside, so you can use the
mv command to move the entire hierarchy where it belongs after it is restored.
5. Use the ufsrestore command to restore the file.
# ufsrestore xvf /dev/rmt/n filename ...
x
Tells ufsrestore to copy specific files or directories in
the filename argument.
v
Displays the file names as they are restored.
f /dev/rmt/n
Identifies the tape device name.
One or more individual file or directory names separated
filename ...
by spaces, for example: ./export/home/user1/mail
./export/home/user2/mail.
6. Type the volume number where files are located and press Return.
Specify next volume #: 1
The file is restored to the current working directory.
7. To keep the mode of the current directory unchanged, type n and press Return
at the set owner/mode prompt.
set owner/mode for ’.’? [yn] n
8. Verify the restored files.
a. List the restored files and directories.
# ls -l
A list of files and directories is displayed.
b. Check the list to be sure all the files and directories you specified in the list
have been restored.
c. Move the files to the proper directories.
590
Example—Restoring Specific Files Non-Interactively
The following example restores the passwd and shadow files to the /var/tmp
directory.
# cd /var/tmp
# ufsrestore xvf /dev/rmt/0 ./etc/passwd ./etc/shadow
Verify volume and initialize maps
Media block size is 126
Dump
date: Wed Jul 14 08:42:42 1999
Dumped from: the epoch
Level 0 dump of a partial file system on starbug:/etc
Label: none
Extract directories from tape
Initialize symbol table.
Make node ./etc
Extract requested files
You have not read any volumes yet.
Unless you know which volume your file(s) are on you should start
with the last volume and work towards the first.
Specify next volume #: 1
extract file ./etc/passwd
extract file ./etc/shadow
Add links
Set directory mode, owner, and times.
set owner/mode for ‘.’? [yn] n
Directories already exist, set modes anyway? [yn] n
# cd etc
# mv passwd /etc
# mv shadow /etc
# ls -l /etc
How to Restore Files Using a Remote Tape Drive
You can restore files from a remote tape drive by adding remote-host: to the front of
the tape device name, when using the ufsrestore command.
ufsrestore xf [user@]remote-host:/dev/rmt/n filename
Example—Restoring Files Using a Remote Drive
The following example restores files using a remote tape drive /dev/rmt/0 on the
system venus.
# ufsrestore xf venus:/dev/rmt/0 filename
Restoring Files and File Systems (Tasks)
591
How to Restore a Complete File System
Note - You cannot use this procedure to restore root (/) or /usr. See “How to
Restore the root (/) and /usr File Systems” on page 595 for instructions on restoring
these file systems.
1.
Become superuser.
2.
If necessary, unmount the file system.
# umount /dev/rdsk/device-name
3.
Create the new file system with the newfs(1M) command.
# newfs /dev/rdsk/device-name
You are asked if you want to construct a new file system on the raw device.
Verify that the device-name is correct so you don’t destroy the wrong file system.
4.
Confirm that the new file system should be created.
newfs: construct a new file system /dev/rdsk/cwtxdysz:(y/n)? y
The new file system is created.
5.
Mount the new file system on a temporary mount point.
# mount /dev/dsk/device-name /mnt
6.
Change to the /mnt directory.
# cd /mnt
You have changed to the mount-point directory.
7.
Write-protect the tapes.
8.
Insert the first volume of the level 0 tape into the tape drive.
9.
Use the ufsrestore command to restore the files on the tapes.
# ufsrestore rvf /dev/rmt/n
592
The level 0 dump is restored. If the dump required multiple tapes, you would be
prompted to load each tape in numeric order.
10. Remove the tape and load the next level tape in the drive.
Always restore tapes starting with 0 and continuing until you reach the highest
level.
11. Repeat Step 7 on page 592 through Step 10 on page 593 for each level of dump,
from the lowest to the highest level.
12. Verify the file system is restored.
# ls
13. Remove the restoresymtable file.
# rm restoresymtable
The restoresymtable file created by ufsrestore is removed.
14. Change to another directory.
# cd /
15. Unmount the newly restored file system.
# umount /mnt
16. Remove the last tape and insert a new tape that is not write-protected in the
tape drive.
17. Use the ufsdump command to make a level 0 backup of the newly restored file
system.
# ufsdump 0uf /dev/rmt/n /dev/rdsk/device-name
You should always do an immediate backup of a newly created file system,
because ufsrestore repositions the files and changes the inode allocation (the
restored file system will appear to have changed since the previous backup).
18. Mount the restored file system.
Restoring Files and File Systems (Tasks)
593
# mount /dev/dsk/device-name mount-point
The restored file system is mounted and available for use.
19. Verify the restored and mounted file system is available.
# ls mount-point
Example—Restoring a Complete File System
The following example restores the /export/home file system.
# umount /export/home
# newfs /dev/rdsk/c0t3d0s7
newfs: construct a new file system /dev/rdsk/c0t3d0s7: (y/n)? y
/dev/rdsk/c0t3d0s7:
410400 sectors in 270 cylinders of 19 tracks, 80 sectors
200.4MB in 17 cyl groups (16 c/g, 11.88MB/g, 5696 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 24432, 48832, 73232, 97632, 122032, 146432, 170832,
195232,
219632,
244032, 268432, 292832, 317232, 341632, 366032, 390432,
# mount /dev/dsk/c0t3d0s7 /mnt
# cd /mnt
# ufsrestore rvf /dev/rmt/0
Verify volume and initialize maps
Media block size is 126
Dump
date: Wed Jul 14 08:49:33 1999
Dumped from: the epoch
Level 0 dump of /export/home on earth:/dev/dsk/c0t3d0s7
Label: none
Begin level 0 restore
Initialize symbol table.
Extract directories from tape
Calculate extraction list.
Warning: ./lost+found: File exists
Make node ./kryten
Make node ./kryten/letters
Make node ./kryten/reports
Extract new leaves.
Check pointing the restore
extract file ./kryten/.cshrc
extract file ./kryten/.login
extract file ./kryten/b
extract file ./kryten/memos
extract file ./kryten/letters/b
extract file ./kryten/letters/letter1
extract file ./kryten/letters/letter2
extract file ./kryten/letters/letter3
extract file ./kryten/reports/reportA
extract file ./kryten/reports/reportB
extract file ./kryten/reports/reportC
(continued)
594
(Continuation)
Add links
Set directory mode, owner, and times.
Check the symbol table.
Check pointing the restore
# ls
# rm restoresymtable
# cd /
# umount /mnt
# ufsdump 0ucf /dev/rmt/0 /export/home
# mount /dev/dsk/c0t3d0s7 /export/home
# ls /export/home
How to Restore the root (/) and /usr File Systems
1. Add a new system disk to the system where the root (/) and /usr file systems
will be restored.
For a detailed description about adding a system disk, refer to Chapter 30 or
Chapter 31.
2. Mount the new file system on a temporary mount point.
# mount /dev/dsk/device-name /mnt
3. Change to the /mnt directory.
# cd /mnt
4. Write-protect the tapes.
5. Use the ufsrestore command to restore the root file system.
# ufsrestore rvf /dev/rmt/n
The level 0 tape is restored.
6. Remove the tape and load the next level tape in the drive.
Always restore tapes starting with 0 and continuing from lowest to highest level.
Restoring Files and File Systems (Tasks)
595

 

 

 

 

 

 

 

Content      ..     16      17      18      19     ..