Contained Within
Find More Documentation
Featured Support Resources
| PDF로 이 문서 다운로드
Backing Up Files and File Systems
7
- This chapter contains these sections:
-
Preparing to Do Backups
- Before you start a backup procedure, you need to know:
-
- The raw device name for the file systems you want to back up
- The type of tape drive you will use
- The device name for the tape drive and whether the drive is local or remote
- The number of tapes you will need
- This section shows you how to find this information.
· How to Find File System Raw Device Names
-
-
Type more /etc/vfstab and press Return. The contents of the /etc/vfstab file are displayed.
-
Look in the mount point column for the name of the file system.
-
Use the raw device name in the device to fsck column with the ufsdump command.
- The example below shows the raw device name to back up the /usr file system on venus is /dev/rdsk/c0t1d0s6.
-
venus% more /etc/vfstab
#device device mount FS fsck auto- mount
#to mount to fsck point type pass mount? options
#
/proc - /proc proc - no -
swap - /tmp tmpfs - yes -
/dev/dsk/c0t3d0s0 /dev/rdsk/c0t3d0s0 / ufs 1 no -
/dev/dsk/c0t3d0s1 - - swap - no -
/dev/dsk/c0t1d0s6 /dev/rdsk/c0t1d0s6 /usr ufs 2 no -
neptune:/export//usr/openwin - /usr/openwin nfs no yes -
neptune:/export/usr/man - /usr/man nfs no yes -
venus%
|
· How to Find the Block Device Name for a Mounted File System
-
-
Type devnm mount-point and press Return.
The block device name for the file system is displayed.
-
venus% devnm /usr
/dev/dsk/c0t1d0s6 /usr
venus%
|
-
-
Use /dev/rdsk/device-name with the ufsdump command.
· How to Display the Slices that Contain File Systems
-
-
Become superuser.
-
Type prtvtoc /dev/rdsk/device-name and press Return. Information for all non-zero slices is displayed.
-
venus% su
Password:
# prtvtoc /dev/rdsk/c0t3d0s2
* /dev/rdsk/c0t3d0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 35 sectors/track
* 6 tracks/cylinder
* 210 sectors/cylinder
* 1019 cylinders
* 974 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 0 32760 32759 /
1 3 01 32760 65520 98279
2 5 01 0 204540 204539
6 4 00 98280 106260 204539
#
|
· How to Determine the Type of a Tape Drive
- You can use the status option to the mt command to get status information about the Xylogics 472 1/2-inch tape drive and the Exabyte EXB-8200 8-mm tape drive.
- The status command also reports information about these 1/4-inch tape drives:
-
- Sysgen (QIC-24)
- Emulex MT-02 (QIC-24)
- Archive QIC-150
- Wangtek QIC-150
- To determine what type of tape drive you have:
-
-
Load a tape into the drive you want information about.
-
Type mt -f /dev/rmt/0 status and press Return.
-
Repeat the command, substituting tape drive numbers 1, 2, 3, and so on to display information about all available tape drives.
- This example shows status for an Emulex drive (/dev/rmt/0) and an Exabyte tape drive (/dev/rmt/1) on venus and a QIC-150 tape drive on mars:
-
venus% mt -f /dev/rmt/0 status
Emulex MT-02 QIC-24 tape drive:
sense key(0x2)= not ready residual= 0 retries= 0
file no= 0 block no= 0
venus% mt -f /dev/rmt/1 status
Exabyte EXB-8200 8mm tape drive:
sense key(0x0)= NO Additional Sense residual= 0 retries= 0
file no= 0 block no= 0
venus% rlogin mars
Password:
mars% mt -f /dev/rmt/0 status
Archive QIC-150 tape drive:
sense key(0x0)= No Additional Sense residual= 0 retries= 0
file no= 0 block no= 0
mars%
|
- Here is an quick way to poll a system and locate all tape drives. In this example, the tape drive is at 0:
-
mars% sh
$ for drive in 0 1 2 3 4 5 6 7
> do
> mt -f /dev/rmt/$drive status
> done
Archive QIC-150 tape drive:
sense key(0x0)= No Additional Sense residual= 0 retries= 0
file no= 0 block no= 0
/dev/rmt/1: No such file or directory
/dev/rmt/2: No such file or directory
/dev/rmt/3: No such file or directory
/dev/rmt/4: No such file or directory
/dev/rmt/5: No such file or directory
/dev/rmt/6: No such file or directory
/dev/rmt/7: No such file or directory
$ exit
mars%
|
· How to Find Out How Many Tapes You Need
- To find out how many tapes you need to do a full backup on a file system:
-
-
Type ufsdump [options] S backup-device filesystem and press Return. The S option estimates the size in bytes of the incremental backup.
-
Divide the estimated size by the capacity of the tape to see how many tapes you need.
See Table 6-3 on page 102 for a list of tape capacities.
-
Example: How to Find Out How Many Tapes You Need In this example, the file system of 489472 bytes will fit on one QIC-150 150-Mbyte tape:
-
# ufsdump 0S /dev/rdsk/c0t3d0s7
489472
#
|
Doing Complete Backups
- Before you perform the backup procedure, there are several steps you need to take to prepare for the backup.
-
Note - It's best to perform backups in single-user mode or with the file system unmounted. When the file system is active while it is being backed up, some data may not be included in the backup. If directory level operations (creating, removing, and renaming files and directories) are done while the file system is being backed up, you may not be able to correctly restore data from the backup tape.
· How to Do a Complete Backup on Cartridge Tape
- This procedure specifies a full level 0 backup on cartridge tape, updating the /etc/dumpdates file.
-
-
Take the system down to single-user level.
a. On a server, become superuser, change to the root directory, run
shutdown, then reboot and come up in single-user mode.
-
# cd /
# shutdown
Various messages from shutdown appear
#
# halt
ok boot -s
|
-
b. On a standalone system, become superuser, then type init s and press Return.
-
-
[Optional] If you think the file system has problems, type fsck raw_device and press Return.
-
Insert a tape that is not write protected into the tape drive.
-
-
Type /usr/bin/ufsdump 0ucf /dev/rmt/unit /dev/rdsk/cntndnsn and press Return.
The 0 option specifies a complete level 0 backup, the u option updates the /etc/dumpdates file; the c option specifies a cartridge tape drive; and the f option indicates that you specify the tape drive file name as part of the command-line argument. The tape is rewound unless you use the n option after the tape unit number (for example, /dev/rmt/0n). See "Options and Arguments for the ufsdump Command" on page 131 for a complete description of the options.
-
When prompted, remove the tape and replace with the next volume.
-
Label each tape with the volume number, level, date, system name, and file system.
-
Examples: Full Backups To make a full dump of a root file system on c0t3d0s0, on a 150-Mbyte cartridge tape (/dev/rmt/0):
-
# ufsdump 0cf dev/rmt/0 /dev/rdsk/c0t3d0s0
|
- In this example, a full backup is made of /dev/dsk/c0t1d0s0.
-
moon:# ufsdump 0uf /dev/rmt/0 /dev/dsk/c0t1d0s0
DUMP: Writing 32 Kilobyte records
DUMP: Date of this level 0 dump: Thu Feb 10 17:28:54 1994
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c0t1d0s0 to /dev/rmt/0.
DUMP: Mapping (Pass I) [regular files]
DUMP: Mapping (Pass II) [directories]
DUMP: Estimated 42934 blocks (20.96MB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: Tape rewinding
DUMP: 42878 blocks (20.94MB) on 1 volume at 603 KB/sec
DUMP: DUMP IS DONE
DUMP: Level 0 dump on Thu Feb 10 17:28:54 1994
moon:#
|
Doing Incremental Backups
- Plan your backup schedule using information from "Planning a Backup Schedule" on page 112. This section provides instructions for how to do incremental backups.
· How to Back Up Incremental Changes
-
-
Bring the system to single-user mode.
-
Become superuser.
-
Put a tape into the tape drive.
-
Type ufsdump [1-9]ucf /dev/rmt/unit /dev/rdsk/cntndnsn and press Return.
Type the level of the backup at the beginning of the ufsdump arguments. For example, to do a level 9 backup, type 9ucf.
-
Remove the tape from the tape drive and label it.
Backing Up Individual Files and Directories
- You use the ufsdump command to back up individual files and directories.
· How to Back Up Individual Files and Directories
-
* Type ufsdump [options] tape-drive filenames Where filenames is one or more individual file or directory names separated by spaces, for example, /home/user1/mail /home/user2/mail.
Using a Remote Drive to Do Backups
- You can use the ufsdump command to back up files from one system to a drive on another system. The command syntax is:
-
ufsdump [options] remote-host:dump-file files-to-backup
-
Note - The naming convention you use for the remote drive depends on the system where the drive resides. Use the naming conventions that match the SunOS release on the system with the remote tape drive.
- To run a backup as a different user on a remote host, the command syntax is as follows:
-
ufsdump [options] user@remote-host:dump-file files-to-backup
- The only difference between this command and one you use to back up to a local drive is that you preface the dump-file argument with the remote-host name followed by a colon (:).
· How to Find Out if You Can Access a Remote Drive
-
-
Become superuser.
-
Type rsh remote-host cat /etc/motd and press Return. If a message like this is displayed, your server is in the remote system's /.rhosts file.
-
neptune% rsh mars cat /etc/motd
Sun Microsystems, Inc. SunOS 5.4 May 1994
neptune%
|
- If the message Unknown host is displayed, contact the person responsible for the remote system to add the local system to the /.rhosts file. If you are not using Name Server, NIS, or NIS+, you must also add the IP address for the remote machine to the local /etc/hosts file.
Doing Backups on Remote Systems
- You can do backups on remote systems by remote login (rlogin) to the system and typing the backup command. If the tape drive is local, use the usual command line syntax. If the tape drive is on a remote system, specify the server name as part of the command-line argument.
· How to Back Up SunOS 5.x Systems on a Remote System
-
-
Add the system name to the server's /.rhosts file and the IP address to the server's /etc/hosts file, if necessary.
-
Type rlogin host-name and press Return.
-
Type ufsdump [options] server-name:/dev/rmt/unit files-to-back-up.
· How to Back Up SunOS 5.x Systems to a Remote SunOS 4.x System
-
-
Type rlogin host-name and press Return.
-
Type ufsdump [options] server-name:/dev/rst/unit files-to-back-up. Note that you use the old-style tape drive device name if the tape drive is on a SunOS 4.x system.
· How to Back Up SunOS 4.x Systems to a Remote Sun OS 5.x System
-
-
Type rlogin host-name and press Return.
-
Type dump [options] server-name:/dev/rmt/unit files-to-back-up. Notice that you run the dump command on the SunOS 4.x system.
Troubleshooting When the Root File System Fills Up
-
Symptom: You do a backup of a file system. Nothing is written to the media, but the root file system fills up. The ufsdump command prompts you to install the second volume of media when the root file system is full. Filesystem is full messages will be displayed in the console window.
-
Explanation: If you used an invalid destination device name with the f option, the ufsdump command wrote to a file in the /dev directory of the root file system, filling it up. For example, if you typed /dev/rmt/st0 instead of /dev/rmt/0, the backup file /dev/rmt/st0 was created on the disk rather than being sent to the tape drive.
-
Resolution: 1. Type cd /dev/rmt and press Return.
-
-
Type ls -l and press Return.
A list of tape devices is displayed.
-
Look at the file size for any unusually large files or files that are not device special (no major or minor device numbers) or symbolic links.
-
Become superuser.
-
Type rm filename and press Return.
- This example shows the contents of a typical /dev/rmt directory, with no unusually large files:
-
venus% cd /dev/rmt
venus% ls -l
total 0
crw-rw-rw- 1 root 18, 8 Sep 12 20:45 0
crw-rw-rw- 1 root 18, 8 Sep 12 20:45 0h
crw-rw-rw- 1 root 18, 12 Sep 12 20:45 0hn
crw-rw-rw- 1 root 18, 0 Sep 12 20:45 0l
crw-rw-rw- 1 root 18, 4 Sep 12 20:45 0ln
crw-rw-rw- 1 root 18, 8 Sep 12 20:45 0m
crw-rw-rw- 1 root 18, 12 Sep 12 20:45 0mn
crw-rw-rw- 1 root 18, 12 Sep 12 20:45 0n
venus%
|
Options and Arguments for the ufsdump Command
- This section describes in detail the options and arguments for the ufsdump command. The syntax for the ufsdump command is:
-
-
/usr/sbin/ufsdump [options] [arguments] files-to-back-up
-
options is a single string of one-letter option names.
-
arguments may be multiple strings.
- The option letters and the arguments that go with them must be in the same order and the files-to-back-up argument must come last.
Default Command Options
- If you run the ufsdump command without any options, using this syntax:
-
ufsdump files-to-back-up
-
ufsdump uses these options, by default:
-
-
ufsdump 9uf /dev/rmt/0 files-to-back-up
- These options do a level 9 incremental backup to the default tape drive at its preferred density.
Options for the ufsdump Command
-
Table 7-1 describes the options for the ufsdump command.
-
Table 7-1 ufsdump
| Option | Description |
| 0-9 | Backup level. Level 0 is for a full backup of the whole file system specified by files-to-backup. Levels 1-9 are for incremental backups of files that have changed since the last lower-level backup. |
| a archive-file | Archive file. Store (archive) a backup table of contents in a specified file on the disk. The file can be understood only by ufsrestore, which uses it to determine whether a file to be restored is present in a backup file, and if so, on which volume of the media it resides. |
| b factor | Blocking factor. The number of 512-byte blocks to write to tape per operation. |
| c | Cartridge. Back up to cartridge tape. When end-of-media detection applies, this option sets the block size to 126. |
-
Table 7-1 ufsdump(Continued)
| Option | Description |
| d bpi | Tape density. You need to use this option only when ufsdump cannot detect the end of the media. |
| D | Diskette. Back up to diskette. |
| f dump-file | Dump file. Write the files to the destination specified by dump- file instead of the default device. If the file is specified as user@system:device, ufsdump attempts to execute as the specified user on the remote system. The specified user must have a .rhosts file on the remote system that allows the user invoking the command on the local system to access the remote system. |
| l | Autoload. Use this option if you have an autoloading (stackloader) tape drive. When the end of a tape is reached, this option takes the drive offline and waits up to two minutes for the tape drive to be ready again. If the drive is ready within two minutes, it continues. If it is not ready after two minutes, it prompts an operator to load another tape. |
| n | Notify. When intervention is needed, send a message to all terminals of all users in the sys group. |
| o | Offline. When finished with a tape or diskette, take the drive offline, rewind (if tape), and if possible remove the media (for example, eject a diskette or remove 8-mm autoloaded tape). |
| s size | Size. Specify the length of tapes in feet or number of 1024-byte blocks for diskettes. You need to use this option only when ufsdump cannot detect the end of the media. |
| S | Estimate size of backup. Determine the amount of space that is needed to perform the backup, without actually doing it, and output a single number indicating the estimated size of the backup in bytes. |
| t tracks | Tracks. Specify the number of tracks for 1/4-inch cartridge tape. You need to use this option only when ufsdump cannot detect the end of the media. See "End-of-Media Detection" on page 137 for more information. |
| u | Update the dump record. For a completed backup on a file system, add an entry to the file /etc/dumpdates. The entry indicates the device name for the file system's disk slice, the backup level (0-9), and the date. No record is written when you do not use the u option or when you back up individual files or directories. If a record already exists for a backup at the same level, it is replaced. |
-
Table 7-1 ufsdump(Continued)
| Option | Description |
| v | Verify. After each tape or diskette is written, verify the contents of the media against the source file system. If any discrepancies occur, prompt the operator to mount new media, then repeat the process. Use this option on an unmounted file system only, because any activity in the file system causes it to report discrepancies. |
| w | Warning. List the file systems appearing in /etc/dumpdates that have not been backed up within a day. When you use this option all other options are ignored. |
| W | Warning with highlight. Show all the file systems that appear in /etc/dumpdates and highlight those file systems that have not been backed up within a day. When you use this option all other options are ignored. |
-
Note - The /etc/vfstab file does not contain information about how often to back up a file system.
Backup Device (dump-file) Argument
- The dump-file argument (to the f option) specifies the destination of the backup, which can be one of the following:
-
- Local tape drive or diskette drive
- Remote tape drive or diskette drive
- Standard output
- Use this argument when the destination is not the default local tape drive /dev/rmt/0. If you use the f option, then you must specify a value for dump- file.
-
Note - The dump-file argument can also point to a file on a local or remote disk, which, if used by mistake, can fill up a file system.
-
Local Tape or Diskette Drive Typically, dump-file specifies a raw device file for a tape or diskette drive. When ufsdump writes to an output device, it creates a single backup file which may span multiple tapes or diskettes.
- You specify the tape or diskette device on your system using a device abbreviation. The first device is always 0. For example, if you have a SCSI tape controller and one QIC-24 tape drive that uses medium-density formatting, use this device name:
-
-
/dev/rmt/0m
- When you specify a tape device name, you can also type the letter "n" at the end of the name to indicate that the tape drive should not rewind after the backup is completed. For example:
-
-
/dev/rmt/0mn
- Use the "no-rewind" option if you want to put more than one file onto the tape. If you run out of space during a backup, the tape does not rewind before ufsdump asks for a new tape. See "Backup Device Names" on page 103 for a complete description of device naming conventions.
-
Remote Tape or Diskette Drive You specify a remote tape or diskette drive using the syntax host:device. ufsdump writes to the remote device when root on the local system has access to the remote system. If you usually run ufsdump as superuser, the name of the local system must be included in the /.rhosts file of the remote system. If you specify the device as user@host:device, ufsdump tries to execute as the specified user on the remote system. In this case, the specified user must have a .rhosts file on the remote system to allow the user to access the remote system.
- Use the naming convention for the device that matches the operating system for the system on which the device resides, not the system from which you run the ufsdump command. If the drive is on a system that is running a previous SunOS release (for example, 4.1.1), use the SunOS 4.x device name (for example, /dev/rst0). If the system is running SunOS 5.x system software, use the SunOS 5.x convention (for example, /dev/rmt/0m).
-
Note - You must specify remote devices explicitly with the dump-file argument. In previous SunOS releases rdump directed the output to the remote device defined by the dumphost alias. ufsdump does not have an rufsdump counterpart.
-
Standard Output When you specify a dash (-) as the dump-file argument, ufsdump writes to the standard output.
-
Note - The v option (verify) does not work when the dump-file argument is standard output.
- You can use the ufsdump and ufsrestore commands in a pipeline to copy a file system by writing to the standard output with ufsdump and reading from the standard input with ufsrestore, as shown in this example:
-
# ufsdump 0f - /dev/rdsk/c0t0d0s7 | (cd /home; ufsrestore xf -)
|
Specifying Files to Backup
- You must always include files-to-backup as the last argument on the command line. This argument specifies the source or contents of the backup. It usually identifies a file system but can also identify individual files or directories.
- For a file system, specify the raw device file for a disk slice. It includes the disk controller abbreviation (c), the target number (t) for SCSI devices only, a number indicating the disk number (d), and the slice number (s). For example, if you have a SCSI disk controller on your standalone system (or server) and you want to back up /usr located in slice 6, specify the device as follows:
-
-
/dev/rdsk/c0t0d0s6
- You can specify the file system by its mount point directory (for example, /home), as long as there is an entry for it in the /etc/vfstab file.
- See "Backup Device Names" on page 103 for a complete description of device naming conventions.
- For individual files or directories, type one or more names separated by spaces.
-
Note - When you use ufsdump to back up one or more directories (rather than a whole file system) a level 0 backup is done. Incremental backups do not apply.
End-of-Media Detection
-
ufsdump automatically detects the end-of-media for most devices. Therefore, you do not usually need to use the c, d, s, and t options to perform multivolume backups.
- The only time you need to use the end-of-media options is when ufsdump does not understand the way the device detects the end-of-media or you are going to restore the files on a system with an older version of the restore command. To ensure compatibility with older versions of the restore command, the size option can still force ufsdump to go to the next tape or diskette before reaching the end of the current tape or diskette.
Specifying Tape Characteristics
- If you do not specify any tape characteristics, the ufsdump command uses a set of defaults. Table 7-2 shows some arguments to the ufsdump command that work well for different types of tape cartridges. You can specify tape cartridge (c), density (d), size (s), and number of tracks (t). Note that you can specify the options in any order as long as the arguments that follow match the order of the options.
-
Table 7-2 ufsdump
| Tape | Arguments |
| Diskette | ufsdump Ds 1422 |
| 60-Mbyte cartridge | ufsdump cdst 1000 425 9 |
| 150-Mbyte cartridge | ufsdump cdst 1000 700 18 |
| 1/2-inch tape | ufsdump dsb 1600 2300 126 |
| 2.3-Gbyte 8-mm tape | ufsdump dsb 54000 6000 126 |
| 5.0-Gbyte 8-mm tape | ufsdump dsb 54000 13000 126 |
| 5.0-Gbyte 4-mm tape | ufsdump b 96 |
|
|