System Administration Guide, Volume I
  Sök endast i den här boken
Ladda ner denna bok i PDF

Backing Up Files and File Systems

42

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 Namespage 735
How to Determine the Number of Tapes for Full Backuppage 736
How to Do Backups on Cartridge Tapepage 738
For detailed information on syntax, options, and arguments for the ufsdump command, see Chapter 44, "Reference Information on ufsdump and ufsrestore."

Preparing to Do Backups

Preparing to back up file systems begins with planning, which is described in Chapter 41, "Overview of Backing Up and Restoring File Systems" and covers choosing:
  • A tape drive
  • Which file systems to back up
  • The type of backup (full or incremental)
  • A backup schedule
This section describes other tasks you may 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

· How to Find File System Names

  1. Display the contents of the /etc/vfstab file.


  $ more /etc/vfstab  

  1. Look in the mount point column for the name of the file system.

  2. You will 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  
  #  
  /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     -           yes     -  
  neptune:/export/usr/man -               /usr/man          nfs     -           yes     -  

· How to Determine the Number of Tapes for Full Backup

  1. Become root.

  2. Estimate the size of the backup in bytes by using the usfdump S command.


  # ufsdump S filesystem  

In this command,
S....Displays the estimated number of bytes needed to do the backup.
  1. Divide the estimated size by the capacity of the tape to see how many tapes you need.

    See Table 41-2 on page 719 for a list of tape capacities.

Example--Determining Number of Tapes

In this example, the file system of 489472 bytes will 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, means 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 45, "Copying UFS Files and File Systems," for information about using the dd command.

  • If you are doing remote backups across the network, the system initiating the backup must have entries in its /.rhosts file for the hosts 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 SunOS 4.1.x; use /dev/rmt/0m for a system running Solaris 2.x.

· How to Do Backups on Cartridge 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 root.

  2. Shut down the system.


  # init 0  

  1. Bring the system to run level S (single-user mode).


  ok boot -s  

  1. [Optional] Check the file system for consistency with the fsck command. Running the fsck command using the -m option 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, "Checking File System Integrity."


  # fsck -m /dev/rdsk/device-name  

  1. If you will be backing up file systems onto a remote tape drive:

    a. Add the following entry to the ./rhosts file of the system that is initiating the backup:


  host root  

b. Verify that the host name added to the /.rhosts file above is accessible via the local /etc/inet/hosts file or available NIS or NIS+ name server.
  1. Insert a tape that is not write protected into the tape drive.

  1. Back up files systems using the ufsdump command. Use the following table to select the most common options and arguments for the ufsdump command. See Chapter 44, "Reference Information on ufsdump and ufsrestore" for other options and arguments.

To ...Use This Option or Argument ...For Example ...
Do a full backup0 option (dump level)ufsdump 0ucf /dev/rmt/n files-to-backup
Do an incremental backup1-9 option (dump level)Imported image(194x27)

ufsdump 9ucf /dev/rmt/n files-to-backup

Back up individual filesfilename argumentImported image(194x27)

ufsdump 9ucf /dev/rmt/n /export/home/user1/mail

Record dumps to fileu option (updates /etc/dumpdates file)Imported image(194x27)

ufsdump 9ucf /dev/rmt/n files-to-backup

Specify a cartridge tapec optionImported image(194x27)

ufsdump 9ucf /dev/rmt/n files-to-backup

Specify the tape drive file namef dump-fileImported image(194x27)

ufsdump 9ucf /dev/rmt/1 files-to-backup

Imported image(182x15)

Back up local file systems to a remote host's tape deviceremote-host: argumentufsdump 0ucf pluto:/dev/rmt/0 files-to-backup
Remotely log into a system and back up its file systems to a remote tape deviceuser@remote-host: argumentImported image(194x27)

ufsdump 0ucf sam@chico:/dev/rmt/0 files-to-backup

Imported image(194x27)

  1. When prompted, remove the tape and replace with the next volume.

  2. Label each tape with the volume number, level, date, system name, and file system.

  1. Bring the system back to run level 3 by pressing Control-d.

Example--Full Backup, root (/), Cartridge Tape

In this example, a full backup of the root (/) file system is made on a 150-Mbyte cartridge tape (/dev/rmt/0).

  # init 0  
  ok boot -s  
  # ufsdump 0ucf /dev/rmt/0 /  
   DUMP: Date of this level 0 dump: Thu Oct 20 15:17:45 1994  
   DUMP: Date of last level 0 dump: the epoch  
   DUMP: Dumping /dev/rdsk/c0t3d0s0 (/) to /dev/rmt/0  
   DUMP: mapping (Pass I) [regular files]  
   DUMP: mapping (Pass II) [directories]  
   DUMP: estimated 40044 blocks (19.55MB)  
   DUMP: Writing 63 Kilobyte records  
   DUMP: dumping (Pass III) [directories]  
   DUMP: dumping (Pass IV) [regular files]  
   DUMP: level 0 dump on Thu Oct 20 15:17:45 1994  
   DUMP: Tape rewinding  
   DUMP: 40022 blocks (19.54MB) on 1 volume  
   DUMP: DUMP IS DONE  
  # (Press Control-D to bring system to run level 3)  

Example--Full Backup, /export/home, 4-mm DAT Tape

In this example, a full backup of the /export/home file system is made on a 4-mm DAT tape.

  # ufsdump 0ucf /dev/rmt/0 /export/home  
   DUMP: Date of this level 0 dump: Fri Oct 21 10:36:45 1994  
   DUMP: Date of last level 0 dump: the epoch  
   DUMP: Dumping /dev/rdsk/c0t3d0s7 (/export/home) to /dev/rmt/0  
   DUMP: mapping (Pass I) [regular files]  
   DUMP: mapping (Pass II) [directories]  
   DUMP: estimated 19558 blocks (9.55MB)  
   DUMP: Writing 63 Kilobyte records  
   DUMP: dumping (Pass III) [directories]  
   DUMP: dumping (Pass IV) [regular files]  
   DUMP: level 0 dump on Fri Oct 21 10:36:45 1994  
   DUMP: Tape rewinding  
   DUMP: 19558 blocks (9.55MB) on 1 volume  
   DUMP: DUMP IS DONE  
  #  

Verification--Full Backup, /export/home, 4-mm DAT Tape

Use the ufsrestore command to display the contents of the tape. This command is described in Chapter 43, "Restoring Files and File Systems."

  # ufsrestore tf /dev/rmt/0  
   2  .  
   3  ./lost+found  
   2688./export  
   5376./opt  
   8064./usr  
   10752./var  
   13440./var/sadm  
   2689./var/sadm/install  
   5377./var/sadm/install/admin  
   5572./var/sadm/install/admin/default  
   8065./var/sadm/install/logs  
   2690./var/sadm/install/.lockfile  
   2766./var/sadm/install/contents  
   10753./var/sadm/pkg  
            .  
            .  
            .  
  #  

Example--Incremental Backup, root (/)

In this example, an incremental backup of the root (/) is made on a 4-mm DAT tape device.

  # ufsdump 9ucf /dev/rmt/0 /  
    DUMP: Date of this level 9 dump: Mon Oct 24 09:26:14 1994  
    DUMP: Date of last level 0 dump: Mon Oct 24 09:05:00 1994  
    DUMP: Dumping /dev/rdsk/c0t3d0s0 (/) 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: estimated 9988 blocks (4.88MB)  
    DUMP: Writing 63 Kilobyte records  
    DUMP: dumping (Pass III) [directories]  
    DUMP: dumping (Pass IV) [regular files]  
    DUMP: level 9 dump on Mon Oct 24 09:26:14 1994  
    DUMP: Tape rewinding  
    DUMP: 9992 blocks (4.88MB) on 1 volume  
    DUMP: DUMP IS DONE  
  #  

Verification--Incremental Backup, root (/)


  # ufsrestore tf /dev/rmt/0  
           2   .  
       10752   ./var  
       13440   ./var/sadm  
        2689   ./var/sadm/install  
        2690   ./var/sadm/install/.lockfile  
        2766   ./var/sadm/install/contents  
       10753   ./var/sadm/pkg  
        2734   ./var/adm  
        2780   ./var/adm/sa  
        2951   ./var/adm/sa/sa24  
        2735   ./var/cron  
        2885   ./var/cron/log  
        8086   ./var/spool  
        8087   ./var/spool/locks  
        8088   ./var/tmp  
  #  

Example--Full Backup, Individual Home Directory

In this example, a full backup of the /export/home/kryten directory is made on a 4-mm DAT tape.

  # ufsdump 0ucf /dev/rmt/0 /export/home/kryten  
    DUMP: Date of this level 0 dump: Mon Oct 24 11:06:10 1994  
    DUMP: Date of last level 0 dump: the epoch  
    DUMP: Dumping /dev/rdsk/c0t3d0s7 (/export/home) to /dev/rmt/0  
    DUMP: mapping (Pass I) [regular files]  
    DUMP: mapping (Pass II) [directories]  
    DUMP: estimated 180 blocks (90KB)  
    DUMP: Writing 63 Kilobyte records  
    DUMP: dumping (Pass III) [directories]  
    DUMP: dumping (Pass IV) [regular files]  
    DUMP: 176 blocks (88KB) on 1 volume  
    DUMP: DUMP IS DONE  
  #  

Verification--Full Backup, Individual Home Directory


  # 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 2.x Data to Solaris 2.x System)

In this example, the local /export/home file system on a Solaris 2.x system is backed up to a tape device on a remote Solaris 2.x system called pluto.

  # ufsdump 0ucf pluto:/dev/rmt/0 /export/home  
    DUMP: Date of this level 0 dump: Tue Oct 25 10:30:53 1994  
    DUMP: Date of last level 0 dump: the epoch  
    DUMP: Dumping /dev/rdsk/c0t3d0s7 (/export/home) to /dev/rmt/0  
  on host pluto  
    DUMP: mapping (Pass I) [regular files]  
    DUMP: mapping (Pass II) [directories]  
    DUMP: estimated 19574 blocks (9.56MB)  
    DUMP: Writing 63 Kilobyte records  
    DUMP: dumping (Pass III) [directories]  
    DUMP: dumping (Pass IV) [regular files]  
    DUMP: level 0 dump on Tue Oct 25 10:30:53 1994  
    DUMP: Tape rewinding  
    DUMP: 19574 blocks (9.56MB) on 1 volume  
    DUMP: DUMP IS DONE  
  #  

Verification--Full Backup to Remote System (Solaris 2.x Data to Solaris 2.x System)


  # ufsrestore tf pluto:/dev/rmt/0  
           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  
          32./kryten/reports/reportB  
          33./kryten/reports/reportC  
                .  
                .  
                .  
  #  

Example--Full Backup to Remote System (Solaris 2.x Data to Sun 4.1.x System)

In this example, the local /export/home file system on a Solaris 2.x system is backed up to a tape device on a remote SunOS 4.1.x system (mars). Notice the SunOS 4.x-style device name (/dev/rst0) used with the ufsdump command. To run the ufsdump command, you would log in as root on the Solaris 2.x system.

  # ufsdump 0ucf mars:/dev/rst0 /export/home  
    DUMP: Date of this level 0 dump: Tue Oct 25 15:06:47 1994  
    DUMP: Date of last level 0 dump: the epoch  
    DUMP: Dumping /dev/rdsk/c0t3d0s7 (/export/home) to /dev/rst0 on  
  host mars  
    DUMP: mapping (Pass I) [regular files]  
    DUMP: mapping (Pass II) [directories]  
    DUMP: estimated 19574 blocks (9.56MB)  
    DUMP: Writing 63 Kilobyte records  
    DUMP: dumping (Pass III) [directories]  
    DUMP: dumping (Pass IV) [regular files]  
    DUMP: level 0 dump on Tue Oct 25 15:06:47 1994  
    DUMP: Tape rewinding  
    DUMP: 19574 blocks (9.56MB) on 1 volume  
    DUMP: DUMP IS DONE  
  #  

Verification--Full Backup to Remote System (Solaris 2.x Data to Sun 4.1.x System)


  # 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  
          32      ./kryten/reports/reportB  
          33      ./kryten/reports/reportC  
                  .  
                  .  
                  .  

Example--Full Backup to Remote System (SunOS 4.1.x Data to Solaris 2.x)

In this example, the local root (/) file system on a Sun 4.1.x system (mars) is backed up to a remote tape device on a Solaris 2.x system called pluto.

Note - Notice that when you back up data to a SunOS 4.1.x system, you must use the dump command--not the ufsdump command.


  mars# dump 0ucf pluto:/dev/rmt/0 /  
    DUMP: Date of this level 0 dump: Tue Oct 25 16:05:19 1994  
    DUMP: Date of last level 0 dump: the epoch  
    DUMP: Dumping /dev/rsd2a (/) to /dev/rmt/0 on host pluto  
    DUMP: mapping (Pass I) [regular files]  
    DUMP: mapping (Pass II) [directories]  
    DUMP: estimated 8686 blocks (4.24MB) on 0.10 tape(s).  
    DUMP: dumping (Pass III) [directories]  
    DUMP: dumping (Pass IV) [regular files]  
    DUMP: level 0 dump on Tue Oct 25 16:05:19 1994  
    DUMP: Tape rewinding  
    DUMP: 8690 blocks (4.24MB) on 1 volume  
    DUMP: DUMP IS DONE  
  mars#  

Verification--Full Backup to Remote System (SunOS 4.1.x Data to Solaris 2.x)


  mars# restore tf pluto:/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.3  
        7553      ./etc  
        7554      ./etc/sendmail.cf  
        7555      ./etc/aliases  
        7556      ./etc/aliases.dir  
        7557      ./etc/aliases.pag  
        7558      ./etc/holidays  
        7559      ./etc/dumpdates  
        7560      ./etc/fbtab  
        7561      ./etc/filetype  
        7562      ./etc/format.dat  
        7563      ./etc/fstab  
                  .  
                  .  
                  .  
  mars#  

Troubleshooting

Symptom: Root (/) File System Fills Up 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.