Changes between Version 1 and Version 2 of Backing up Sun Directories


Ignore:
Timestamp:
04/03/06 16:58:54 (20 years ago)
Author:
cdelarcuz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Backing up Sun Directories

    v1 v2  
    11== Backing up Directories ==
    22
    3 Notes for backing up directories can be found [http://www.astro.columbia.edu/~crussell/computing/notes/backup.note here].
     3 Sample commands to tar files to tape.          ( See /nfs/man/notes/solaris_tape.note
     4                                                        for info on tape drives.)
     5
     6 Note:  **Commands below to create tar files will not follow any links - just the
     7          link  file will be copied unless use the h switch.
     8          Also when extracting tar files, not all mode settings will be preserved unless
     9          use the p switch.**
     10        **To put more than one tar file per tape, use device name /dev/rmt/0n(n=norewind)
     11          and also the 'mt'  command to position the tape past the last tar file written.
     12          See 'man mt'. and example 4) below.**
     13
     14 1) > cd /home/my_directory
     15    > tar cvf /dev/rmt/0 .              (will put all files and subdirectories found
     16                                         in my_directory on the tape and rewind
     17                                         the tape)
     18    > cd /home/my_directory/subdirectory
     19    > tar xvf /dev/rmt/0                        (will extract all files and subdirectories
     20                                         from the tar file on the tape and put them
     21                                         in the current directory)
     22
     23 2) > cd /
     24    > tar cvf /dev/rmt/0  usr  home       (will put directories usr and home
     25                                         and all subdirectories of usr and home on the
     26                                         tape and rewind the tape)
     27    > cd /tmp
     28    > tar xvf /dev/rmt/0        home            (will extract directory home and all its
     29                                         subdirectories to the current directory)
     30
     313)  Not a good idea to make a tar file from data begining with '/', for instance:
     32        tar cvf /dev/rmt/0  /home/carmen/wilds 
     33    If you try to restore this, you will get permission denied errors.
     34    Instead, do:
     35        cd /home/carmen/wilds
     36        tar cvf /dev/rmt/0 .
     37
     384)  To add data to a backup tape without overwriting its current contents:
     39
     40        > mt -f /dev/rmt/0n eom         (will space out past the EOF mark)
     41        > tar cvf /dev/rmt/0hn  . > /tmp/newbackup.log &
     42                                        (will backup the current
     43                                         directory and all
     44                                         subdirectories below in
     45                                         compressed mode without
     46                                         rewinding first)
     47See also:
     48
     49 Sample script to dump a file system to tape.
     50 
     51 Script below copies four file systems to the same tape.  A typical 8mm tape
     52 cartridge holds 5.0GB or 10GB in compressed mode. 
     53
     54
     55 Use command:    % ufsrestore -if /dev/rmt/0n
     56 to retrieve a file from a 'dump' tape later on.  The ufsrestore command is
     57 convenient to use, see manual pages.
     58           
     59#! /bin/csh
     60#
     61# Script ufsdump_alceste                      ***Note: Solaris 2.4 man ufsdump
     62#                                                says can detect end-of-media
     63#                                                so can use without s(size)
     64#                                                and d(density) parameters.
     65#       dump filesystems:
     66#                / /usr /usr/openwin /var /opt /home /var_ /src1 ......
     67#       from alceste to local 10GB 8mm tape.
     68#
     69set d = `date`
     70set bkup = /var/backup/alceste_m.log_{$d[2]}{$d[3]}{$d[6]}
     71#
     72echo Backup of alceste > $bkup
     73date >> $bkup
     74echo using ufsdump_alceste >> $bkup
     75#
     76echo Done on `date` >> $bkup
     77#mt -f /dev/rmt/0cn eom                 # will take past last file written on tape.
     78mt -f /dev/rmt/0c rewind
     79mt -f /dev/rmt/0cn status >> $bkup
     80
     81#echo Tape at eom >> $bkup
     82#
     83echo ' ' >> $bkup
     84ufsdump 0f  /dev/rmt/0cn /  >>& $bkup
     85date
     86echo ' ' >> $bkup
     87ufsdump 0f  /dev/rmt/0cn /home  >>& $bkup
     88date
     89echo ' ' >> $bkup
     90ufsdump 0f  /dev/rmt/0cn /src1  >>& $bkup
     91date
     92echo ' ' >> $bkup
     93ufsdump 0f  /dev/rmt/0cn /src2  >>& $bkup
     94date
     95#
     96echo ' ' >> $bkup
     97#
     98mt -f /dev/rmt/0c rewind
     99date >> $bkup
     100
     101
     102
     103                                                       
     104
     105
     106
     107
     108
     109
     110
     111