System Administration Guide: Basic Administration

Chapter 47 Backing Up Files and File Systems (Tasks)

This chapter describes the procedures for backing up file systems by using the ufsdump command.

For information on these procedures, see Backing Up Files and File System (Task Map).

For overview information about performing backups, see Chapter 46, Backing Up and Restoring File Systems (Overview).

For detailed information on ufsdump syntax, options, and arguments, see Chapter 50, UFS Backup and Restore Commands (Reference).

Backing Up Files and File System (Task Map)

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. 

Preparing for File System 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 your file systems 

Perform a full backup of your file systems to get baseline copies of all files. 

Perform an incremental backup of your file systems based on whether keeping copies of files that have changed on a daily basis is important at your site. 

How to Backup a File System to Tape

Preparing for File System Backups

The preparation for backing up file systems begins with planning, which is described in Chapter 46, Backing Up and Restoring File Systems (Overview) and includes choosing the following:

This section describes other tasks you might need to perform before you back up file systems, including the following:

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. Use the directory name listed in the mount point column when you back up the file system.

Example—Finding File System Names

The file systems to be backed up in this example are root (/), /usr, /datab, 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/c0t0d0s5 /dev/rdsk/c0t0d0s5 /datab       ufs   2    yes     -
/dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export/home ufs   2    yes     -
swap              -                  /tmp         tmpfs -    yes     -

How to Determine the Number of Tapes Needed for a Full Backup

  1. Become superuser or assume an equivalent role.

  2. Estimate the size of the backup in bytes.


    # ufsdump S file-system
    

    The S displays the estimated number of bytes that are needed to do the backup.

  3. Divide the estimated size by the capacity of the tape to see how many tapes you need.

    For a list of tape capacities, see Table 46–5.

Example—Determining Number of Tapes

In this example, the file system of 489,472 bytes easily fits on a 150-Mbyte tape.


# ufsdump S /export/home
489472

Backing Up a File System

The following are general guidelines for performing backups:


Note –

Use the nisbackup command to back up a NIS+ master server. For information on using this command, see System Administration Guide: Naming and Directory Services (FNS and NIS+).


How to Backup a File System 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 or assume an equivalent role.

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


    # shutdown -g30 -y
    
  3. (Optional) Check the file system for consistency.


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

    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 43, Checking UFS File System Consistency (Tasks).

  4. If you need to back up file systems to a remote tape drive:

    1. 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.

    2. 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 the /dev/rmt/0 device.

  6. Insert a tape that is not write-protected into the tape drive.

  7. Back up file systems.


    # ufsdump options arguments filenames
    

    The following examples show how to use the most common ufsdump options and arguments:

    For other ufsdump options and arguments, see Chapter 50, UFS Backup and Restore Commands (Reference).

  8. If prompted, remove the tape and insert the next tape volume.

  9. Label each tape with the volume number, dump level, date, system name, disk slice, and file system.

  10. Bring the system back to run level 3 by pressing Control-D.

  11. Verify that the backup was successful.


    # ufsrestore tf device-name
    

Example—Performing a Full Backup of root (/)

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:


# shutdown -g30 -y
# ufsdump 0ucf /dev/rmt/0 /
  DUMP: Writing 63 Kilobyte records
  DUMP: Date of this level 0 dump: Wed Sep 05 13:27:20 2001
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rdsk/c0t1d0s0 (earth:/) to /dev/rmt/0.
  DUMP: Mapping (Pass I) [regular files]
  DUMP: Mapping (Pass II) [directories]
  DUMP: Estimated 57150 blocks (27.91MB).
  DUMP: Dumping (Pass III) [directories]
  DUMP: Dumping (Pass IV) [regular files]
  DUMP: Tape rewinding
  DUMP: 57076 blocks (27.87MB) on 1 volume at 265 KB/sec
  DUMP: DUMP IS DONE
  DUMP: Level 0 dump on Wed Sep 05 13:27:20 2001
  # ufsrestore tf /dev/rmt/0
         2      .
         3      ./lost+found
      3776      ./usr
      7552      ./var
     11328      ./export
     15104      ./export/home
     18880      ./etc
     22656      ./etc/default
     22657      ./etc/default/sys-suspend
     22673      ./etc/default/cron
     22674      ./etc/default/devfsadm
     22675      ./etc/default/dhcpagent
     22676      ./etc/default/fs
     22677      ./etc/default/inetinit
     22678      ./etc/default/kbd
     22679      ./etc/default/mpathd
     22680      ./etc/default/nfslogd
     22681      ./etc/default/passwd
                .
                .
                .
  # (Press Control-d to bring system to run level 3)

Example—Performing an Incremental Backup of root (/)

The following example shows how to do an incremental backup of the root (/) file system. The following ufsdump options are included:


# ufsdump 9ucf /dev/rmt/0 /
  DUMP: Writing 63 Kilobyte records
  DUMP: Date of this level 9 dump: Fri Jul 13 10:58:12 2001
  DUMP: Date of last level 0 dump: Fri Jul 13 10:46:09 2001
  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: 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 Fri Jul 13 10:58:12 2001
# 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—Performing a Full Backup, Individual Home Directory

The following example shows how to do a full backup of the /export/home/kryten directory. The following ufsdump options are included:


# ufsdump 0ucf /dev/rmt/0 /export/home/kryten
  DUMP: Writing 63 Kilobyte records
  DUMP: Date of this level 0 dump: Fri Jul 13 11:30:45 2001
  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]
  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—Performing a Full Backup to Remote System (Solaris 9 Data to Solaris 9 System)

The following example shows how to do a full backup of a local /export/home file system on a Solaris 9 system (starbug) to a tape device on a remote Solaris 9 system (earth).The following ufsdump options are included:


# ufsdump 0ucf earth:/dev/rmt/0 /export/home
  DUMP: Writing 63 Kilobyte records
  DUMP: Date of this level 0 dump: Wed Sep 05 14:52:31 2001
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rdsk/c0t0d0s7 (starbug:/export/home) to earth:/dev ...
  DUMP: Mapping (Pass I) [regular files]
  DUMP: Mapping (Pass II) [directories]
  DUMP: Estimated 266 blocks (133KB).
  DUMP: Dumping (Pass III) [directories]
  DUMP: Dumping (Pass IV) [regular files]
  DUMP: Tape rewinding
  DUMP: 250 blocks (125KB) on 1 volume at 247 KB/sec
  DUMP: DUMP IS DONE
  DUMP: Level 0 dump on Wed Sep 05 14:52:31 2001
# ufsrestore tf earth:/dev/rmt/0
         2      .
         3      ./lost+found
      7168      ./rimmer
      7169      ./rimmer/.profile
     21504      ./rimmer/scdir
     21505      ./rimmer/scdir/scd557
     21506      ./rimmer/scdir/scd772
     10752      ./lister
     10753      ./lister/.profile
     10754      ./lister/filea
     10755      ./lister/fileb
     10756      ./lister/filec
     14336      ./pmorph
     14337      ./pmorph/.profile
      3584      ./pmorph/bigdir
      3585      ./pmorph/bigdir/bigfile
     17920      ./pmorph/smalldir
     17921      ./pmorph/smalldir/smallfile
 #