This chapter describes the procedures for backing up file systems by using the ufsdump command.
For information on these procedures, see Backing Up UFS Files and File System (Task Map).
For overview information about performing backups, see Chapter 23, Backing Up and Restoring UFS File Systems (Overview).
For information about backing up individual files to diskettes, see Chapter 28, Copying UFS Files and File Systems (Tasks).
For additional information on the ufsdump command, see Chapter 27, UFS Backup and Restore Commands (Reference).
Task |
Description |
For Instructions |
---|---|---|
1. Prepare for file system backups. |
Identify the file systems, the type of backup, and the tape device to be used for the backups. | |
2. Determine the number of tapes needed to back up a file system. |
Determine the number of tapes that are needed for a full backup of a file system. |
How to Determine the Number of Tapes Needed for a Full Backup |
3. Back up file systems. |
Perform a full backup of file systems to get baseline copies of all files. Perform an incremental backup of file systems based on whether keeping copies of files that have changed on a daily basis is important at your site. |
The preparation for backing up file systems begins with planning, which is described in Chapter 23, Backing Up and Restoring UFS File Systems (Overview) and includes choosing the following:
The file systems to back up
The type of backup (full or incremental) to perform
A backup schedule
A tape drive
For more information, see Chapter 23, Backing Up and Restoring UFS File Systems (Overview).
This section describes two other tasks you might need to perform before you back up file systems:
Finding the names of file systems to back up
Determining the number of tapes that are needed for a full backup
Display the contents of the /etc/vfstab file.
$ more /etc/vfstab |
Look in the mount point column for the name of the file system.
Use the directory name listed in the mount point column when you back up the file system.
In this example, the file systems to be backed up are root (/), /usr, and and /export/home.
# more /etc/vfstab #device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # 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 - /devices - /devices devfs - no - sharefs - /etc/dfs/sharetab sharefs - no - ctfs - /system/contract ctfs - no - objfs - /system/object objfs - no - swap - /tmp tmpfs - yes - |
Become superuser or assume an equivalent role.
Estimate the size of the backup in bytes.
# ufsdump [0]S file-system |
Use the S option to display the estimated number of bytes that are needed to do the backup if this is the first backup of the file system.
Use the 0S option to display the estimated number of bytes that are needed to do the backup if this is not the first backup of the file system.
Divide the estimated size by the capacity of the tape to determine how many tapes you need.
For a list of tape capacities, see Table 23–5.
In this example, the file system easily fits on a 150-MB tape.
# ufsdump S /export/home 178176 |
The following are general guidelines for performing backups:
Use single-user mode or unmount the file system, unless you are creating a snapshot of a file system. For information about UFS snapshots, see Chapter 25, Using UFS Snapshots (Tasks).
Be aware that backing up file systems when directory-level operations (such as creating, removing, and renaming files) and file-level activity are occurring simultaneously 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. In addition, you can direct the output to the system on which the tape device is located. Typically, the tape device 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 device is to pipe the output from the ufsdump command to the dd command. For information about using the dd command, see Chapter 28, Copying UFS Files and File Systems (Tasks).
If you are doing remote backups across the network, the system with the tape device must have entries in its /.rhosts file for each client that will be using the device. Also, the system that initiates the backup must be included in the /.rhosts file on each system that it will back up.
The following are general steps for backing up file systems by using the ufsdump command. The examples show specific uses of options and arguments.
Become superuser or assume an equivalent role.
Bring the system to run level S (single-user mode).
For example:
# shutdown -g30 -y |
(Optional) Check the file system for consistency.
For example:
# fsck -m /dev/rdsk/c0t0d0s7 |
The fsck -m command checks for the consistency of file systems. For example, power failures can leave files in an inconsistent state. For more information on the fsck command, see Chapter 21, Checking UFS File System Consistency (Tasks).
If you need to back up file systems to a remote tape drive, follow these steps:
On the system to which the tape drive is attached (the tape server), add the following entry to its /.rhosts file:
host root |
The host entry specifies the name of the system on which you will run the ufsdump command to perform the backup.
On the tape server, verify that the host added to the /.rhosts file is accessible through the name service.
Identify the device name of the tape drive.
The default tape drive is the /dev/rmt/0 device.
Insert a tape that is write-enabled into the tape drive.
Back up file systems.
# ufsdump options arguments filenames |
You can back up file systems or directories, or files within file systems. For information on backing up individual files, see tar(1) or cpio(1).
The following examples show how to use the most common ufsdump options and arguments:
For other ufsdump options and arguments, see Chapter 27, UFS Backup and Restore Commands (Reference).
If prompted, remove the tape and insert the next tape volume.
Label each tape with the volume number, dump level, date, system name, disk slice, and file system.
Bring the system back to run level 3 by pressing Control-D.
Verify that the backup was successful.
# ufsrestore tf device-name |
The following example shows how to do a full backup of the root (/) file system. The system in this example is brought to single-user mode before the backup. The following ufsdump options are included:
0 specifies a 0 level dump (or a full backup).
u specifies that the /etc/dumpdates file is updated with the date of this backup.
c identifies a cartridge tape device.
f /dev/rmt/0 identifies the tape device.
/ is the file system being backed up.
For example:
# init 0 ok boot -s . . . # ufsdump 0ucf /dev/rmt/0 / DUMP: Date of this level 0 dump: Mon Jul 12 10:00:50 2010 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: Writing 63 Kilobyte records DUMP: Estimated 1843276 blocks (900.04MB). DUMP: Dumping (Pass III) [directories] DUMP: Dumping (Pass IV) [regular files] DUMP: 1843252 blocks (900.03MB) on 1 volume at 6602 KB/sec DUMP: DUMP IS DONE DUMP: Level 0 dump on Mon Jul 12 10:22:50 MDT 2010 # ufsrestore tf /dev/rmt/0 2 . 3 ./lost+found 4 ./usr 5 ./var 6 ./export 7 ./bin 8 ./dev . . . # (Press Control-D to bring system to run level 3) |
The following example shows how to do an incremental backup of the root (/) file system in single-user mode. The following ufsdump options are included:
9 specifies a 9 level dump (or an incremental backup).
u specifies that the /etc/dumpdates file is updated with the date of this backup.
c identifies a cartridge tape device.
f /dev/rmt/0 identifies the tape device.
/ is the file system being backed up.
# init 0 ok boot -s # ufsdump 9ucf /dev/rmt/0 / DUMP: Date of this level 9 dump: Mon Jul 12 10:52:50 2010 DUMP: Date of last level 0 dump: Mon Jul 12 10:50:50 2010 DUMP: Dumping /dev/rdsk/c0t0d0s0 (starbug:/) to /dev/rmt/0. DUMP: Mapping (Pass I) [regular files] DUMP: Mapping (Pass II) [directories] DUMP: Mapping (Pass II) [directories] DUMP: Mapping (Pass II) [directories] DUMP: Writing 63 Kilobyte records DUMP: Estimated 422 blocks (211KB). DUMP: Dumping (Pass III) [directories] DUMP: Dumping (Pass IV) [regular files] DUMP: 376 blocks (188KB) on 1 volume at 1843 KB/sec DUMP: DUMP IS DONE DUMP: Level 9 dump on Mon Jul 12 10:55:50 2010 # ufsrestore tf /dev/rmt/0 2 . 9 ./etc 304 ./etc/dumpdates 1117 ./devices 1118 ./devices/pseudo 3381 ./devices/pseudo/pts@0:1 . . . |
# init 0 ok boot -s # ufsdump 9ucf /dev/rmt/0 / DUMP: Date of this level 9 dump: Mon Jul 12 10:33:14 2010 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /dev/rdsk/c2t1d0s0 (v880-brm-03:/root) to /dev/rmt/0. DUMP: Mapping (Pass I) [regular files] DUMP: Mapping (Pass II) [directories] DUMP: Writing 63 Kilobyte records DUMP: Estimated 120694 blocks (58.93MB). DUMP: Dumping (Pass III) [directories] DUMP: Dumping (Pass IV) [regular files] DUMP: 120580 blocks (58.88MB) on 1 volume at 9026 KB/sec DUMP: DUMP IS DONE DUMP: Level 9 dump on Mon Jul 12 10:33:14 2010 # ufsrestore tf /dev/rmt/0 2 . 9 ./etc 304 ./etc/dumpdates 1117 ./devices 1118 ./devices/pseudo 3381 ./devices/pseudo/pts@0:1 . . . |
The following example shows how to do a full backup of the /export/home/kryten home directory. The following ufsdump options are included:
0 specifies that this is a 0 level dump (or a full backup).
u specifies that the /etc/dumpdates file is updated with the date of this backup.
c identifies a cartridge tape device.
f /dev/rmt/0 identifies the tape device.
/export/home/kryten is the directory being backed up.
# ufsdump 0ucf /dev/rmt/0 /export/home/kryten DUMP: Date of this level 0 dump: Wed Jul 10:35:18 2010 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /dev/rdsk/c0t0d0s7 (starbug:/export/home) to /dev/rmt/0. DUMP: Mapping (Pass I) [regular files] DUMP: Mapping (Pass II) [directories] DUMP: Writing 63 Kilobyte records DUMP: Estimated 105158 blocks (51.35MB). DUMP: Dumping (Pass III) [directories] DUMP: Dumping (Pass IV) [regular files] DUMP: 105082 blocks (51.31MB) on 1 volume at 5025 KB/sec DUMP: DUMP IS DONE DUMP: Level 9 dump on Mon Jul 12 10:38:14 2010 # ufsrestore tf /dev/rmt/0 232 ./kryten 233 ./kryten/filea 234 ./kryten/fileb 235 ./kryten/filec 236 ./kryten/letters 237 ./kryten/letters/letter1 238 ./kryten/letters/letter2 239 ./kryten/letters/letter3 240 ./kryten/reports 241 ./kryten/reports/reportA 242 ./kryten/reports/reportB 243 ./kryten/reports/reportC |
The following example shows how to do a full backup of a local /export/home file system on a Solaris 10 system (mars) to a tape device on a remote Solaris 10 system (earth) in single-user mode. The systems must be set up so that remote access is enabled. The following ufsdump options are included:
0 specifies a 0 level dump (or a full backup).
u specifies that the /etc/dumpdates file is updated with the date of this backup.
c identifies a cartridge tape device.
f earth:/dev/rmt/0 identifies the remote system name and tape device.
/export/home is the file system being backed up.
# ufsdump 0ucf earth:/dev/rmt/0 /export/home DUMP: Date of this level 0 dump: Mon Jul 12 10:36:30 MDT 2010 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /dev/rdsk/c0t0d0s7 (mars:/export/home) to earth:/dev/rmt/0. DUMP: Mapping (Pass I) [regular files] DUMP: Mapping (Pass II) [directories] DUMP: Writing 63 Kilobyte records DUMP: Estimated 105172 blocks (51.35MB). DUMP: Dumping (Pass III) [directories] DUMP: Dumping (Pass IV) [regular files] DUMP: 105082 blocks (51.31MB) on 1 volume at 4425 KB/sec DUMP: DUMP IS DONE DUMP: Level 0 dump on Mon Jul 12 10:39:30 MDT 2010 # ufsrestore tf earth:/dev/rmt/0 2 . 3 ./lost+found 4 ./kryten 5 ./kryten/filea 6 ./kryten/fileb 7 ./kryten/filec 8 ./kryten/letters 9 ./kryten/letters/letter1 10 ./kryten/letters/letter2 11 ./kryten/letters/letter3 12 ./kryten/reports . . . |