System Administration Guide, Volume I

Doing Backups

The following are general guidelines for performing backups:


Note -

Use the nisbackup command to backup a NIS+ master server running the Solaris 2.5 release or compatible versions. See Solaris Naming Administration Guide for information on using this command.


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 31, Checking File System Integrity.


    # fsck -m /dev/rdsk/ device-name
    
  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

      host

      Specifies the name of the system on which you will run ufsdump 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 /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 36, The ufsdump and ufsrestore Commands (Reference) for other options and arguments.

    To ... 

    Use This Option or Argument ... 

    For Example ... 

    See ... 

    Do a full backup 

    0 option  

    ufsdump 0ucf /dev/rmt/0 /

    "Example--Full Backup, root (/)"

    Do an incremental backup 

    1-9 option  

    ufsdump 9ucf /dev/rmt/0 /

    "Example--Incremental Backup, root (/) "

    Back up individual files 

    Specify a file or directory 

    ufsdump ucf /dev/rmt/0 /export/home/kryten

     

    Record dumps to /etc/dumpdates file

    -u option

    ufsdump 9ucf /dev/rmt/0 /export/home

    "Example--Incremental Backup, root (/) "

    Specify a cartridge tape 

    -c option

    ufsdump 9ucf /dev/rmt/0 /export/home

    "Example--Incremental Backup, root (/) "

    Specify the tape drive 

    -f dump-file

    ufsdump 9ucf /dev/rmt/0 /export/home

    "Example--Incremental Backup, root (/) "

    Back up local file systems to a remote system's tape device 

    remote-system:dump-file

    ufsdump 0ucf pluto:/dev/rmt/0 /export/home

    "Example--Full Backup to Remote System (Solaris 2.6 Data to Solaris 7 System)"

  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 35, Restoring Files and File Systems (Tasks).

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 Jun 09 10:14:54 1998
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rdsk/c0t3d0s0 (pluto:/) to /dev/rmt/0.
  DUMP: Mapping (Pass I) [regular files]
  DUMP: Mapping (Pass II) [directories]
  DUMP: Estimated 73708 blocks (35.99MB).
  DUMP: Dumping (Pass III) [directories]
  DUMP: Dumping (Pass IV) [regular files]
  DUMP: Tape rewinding
  DUMP: 73582 blocks (35.93MB) on 1 volume at 100 KB/sec
  DUMP: DUMP IS DONE
  DUMP: Level 0 dump on Tue Jun 09 10:14:54 1998
# ufsrestore tf /dev/rmt/0
         2	.
         3	./lost+found
      5696	./usr
     11392	./export
     17088	./export/home
     22784	./export/root
     28480	./export/swap
     34176	./opt
     39872	./var
     45568	./var/sadm
     51264	./var/sadm/install
     56960	./var/sadm/install/admin
     57011	./var/sadm/install/admin/default
                      .
                      .
                      .
# 
(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 Jun 09 11:04:41 1998
  DUMP: Date of last level 0 dump: Tue Jun 09 10:14:54 1998
  DUMP: Dumping /dev/rdsk/c0t3d0s0 (pluto:/) 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: Mapping (Pass II) [directories]
  DUMP: Estimated 1502 blocks (751KB).
  DUMP: Dumping (Pass III) [directories]
  DUMP: Dumping (Pass IV) [regular files]
  DUMP: Tape rewinding
  DUMP: 1384 blocks (692KB) on 1 volume at 51 KB/sec
  DUMP: DUMP IS DONE
  DUMP: Level 9 dump on Tue Jun 09 11:04:41 1998
# ufsrestore tf /dev/rmt/0
     39872	./var
     62671	./var/adm
     39915	./var/adm/sa
     40018	./var/adm/sa/sa09
     62810	./var/adm/sulog
     62888	./var/adm/pacct
     91154	./var/cron
     91311	./var/cron/log
      5716	./var/mail
      5835	./var/mail/adm
     45585	./var/spool
     51388	./var/spool/mqueue
     91155	./var/tmp
			.
			.
			.

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 Jun 09 11:12:44 1998
  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--Full Backup to Remote System (Solaris 2.6 Data to Solaris 7 System)

The following example shows a full backup of a local /export/home file system on a Solaris 2.6 system to a tape device on a remote Solaris 7 system called pluto.


# ufsdump 0ucf pluto:/dev/rmt/0 /export/home
  # ufsdump 0ucf pluto:/dev/rmt/0 /export/home
  DUMP: Writing 63 Kilobyte records
  DUMP: Date of this level 0 dump: Tue Jun 09 13:54:27 1998
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rdsk/c0t3d0s7 (venus:/export/home) to pluto:/dev/rmt/0.
  DUMP: Mapping (Pass I) [regular files]
  DUMP: Mapping (Pass II) [directories]
  DUMP: Estimated 38310 blocks (18.71MB).
  DUMP: Dumping (Pass III) [directories]
  DUMP: Dumping (Pass IV) [regular files]
  DUMP: Tape rewinding
  DUMP: 38302 blocks (18.70MB) on 1 volume at 98 KB/sec
  DUMP: DUMP IS DONE
  DUMP: Level 0 dump on Tue Jun 09 13:54:27 1998
# # ufsrestore tf pluto:/dev/rmt/0
         2	.
         3	./lost+found
     34180	./kryten
     34182	./kryten/.login
     34183	./kryten/.cshrc
     51266	./kryten/letters
     51272	./kryten/letters/letter1
     51273	./kryten/letters/letter2
     51274	./kryten/letters/letter3
     57032	./kryten/memos
     74095	./kryten/reports
     74096	./kryten/reports/reportA
     74097	./kryten/reports/reportB
     74098	./kryten/reports/reportC
			.
			.
			.
#

Example--Full Backup to Remote System (Solaris 2.7 Data to SunOS 4.1.3 System)

The following example shows a full backup of a local /export/home file system on a Solaris 7 system to a tape device on a remote SunOS 4.1.3 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: Fri Oct 24 15:06:47 1997
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rdsk/c0t3d0s7 (earth:/export/home) to (mars:/dev/rst0).
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 19574 blocks (9.56MB)
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: level 0 dump on Fri Oct 24 15:06:47 1997
  DUMP: Tape rewinding
  DUMP: 19574 blocks (9.56MB) on 1 volume
  DUMP: DUMP IS DONE
#
 
 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.3 Data to Solaris 7)

The following example shows a full backup of a local root (/) file system on a Sun 4.1.3 system (mars) to a remote tape device on a Solaris 7 system called pluto.


Note -

Notice that when you back up data on a system running SunOS 4.1.3 or a compatible version, you must use the dump command--not the ufsdump command.



# dump 0ucf pluto:/dev/rmt/0 /
  DUMP: Date of this level 0 dump: Tue Oct 21 16:05:19 1997   
  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 21 16:05:19 1997
  DUMP: Tape rewinding
  DUMP: 8690 blocks (4.24MB) on 1 volume
  DUMP: DUMP IS DONE
# 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
                      .
                .
                .
#