Technical article 107232

OSR5:Remote backups over an SCO TCP/IP network using cpio and rcmd.

OpenServer 5.0.0OpenServer 5.0.2OpenServer 5.0.4OpenServer 5.0.5OpenServer 5.0.6OpenServer 5.0.7

Written · Last revised

Problem

I need to do a back up of my system, but the tape drive unit
is on a remote machine on our TCP/IP-based network.  How
can I back up my files from the local system onto the remote
system's tape drive?  Also, how would I make a backup to
the remote machine's hard drive?

Solution

This document addressed these questions.
TABLE OF CONTENTS
Section I.......................................................Introduction
Section II....................................................Setup/Caveats
Section III.........................................Backup/Restore Scenarios
A..................................Remote files to local tape drive
B.................................Local files to remote tape drive
C.................................Local files to remote disk drive
Section IV.........................................................Appendix
+----------------------------------------------------------------------------+
SECTION I - Introduction
The techniques presented here make use of the find, cpio, rcmd
and dd commands.  Three scenarios will be discussed:

(A) Backing up remote system to a tape drive on the local system.

(B) Backing up local /dev/u filesystem to a remote system's tape drive.

(C) Backing up local filesystems to a remote system's hard drive.

The examples make the following assumptions (you can provide your own names when doing the commands):

- the local system's machine name is "locsys" - the remote system's machine name is "remsys" - the device name for the tape drive is "/dev/rct0".

SECTION II - Setup / Caveats

This section presents setup guidelines and caveats when doing remote backups.

(A) This document presents only the very basic foundational command
    stream.  In a production environment this would have to be enhanced
    considerably with regards to error checking, validation, logging.
(B) rcmd(TC) requires setting up host and/or user equivalency with the
    remote system.  This involves setting up the proper entries in the
    /etc/passwd, /etc/hosts.equiv and possibly $(HOME)/.rhosts files.
    See the SCO TCP/IP manual pages for file formats and for more
    information on setting up user equivalency.
(C) Note that rcmd(C) command must be run as root if you are backing
    up whole filesystems.  Otherwise, you will not have permissions
    to read all the files.  Root user equivalency requires setting
    up a "/.rhosts" file.
(D) If the find(C) command's <pathnamelist> ends with an "*" or a "./"
    or a ".", then you need to be sure to be in the correct directory
    when the backup cpio is executed.  The alternative is to use absolute
    pathnames, ie., ones that begin with a leading slash.
(E) The examples shown cross mount points.  That is, a filesystem
    that is mounted within the filesystem being backed up is also
    backed up.  If you wish to exclude mounted filesystems, include
    the "-mount" option to the find command.
(F) The examples shown do not follow symbolic links.  That is, the
    examples back up the symbolic link itself, but not the contents
    of the link, which may even be another entire filesystem.  If you
    want to follow the symbolic links to back up what they point to,
    then include the "-follow" option in the find command.
(G) In general, it is good practice to include the "-K" option to cpio
    to indicate the tape's capacity to facilitate multi-volume backups.
    Unfortunately, since cpio interacts with the user through /dev/tty,
    this will not work with rcmd.  Therefore, it is not recommended that
    backups be made to floppies as they are limited in size and there is
    no easy way to load new disks as the backup continues.  Small tape
    sizes may be problematic as well.  It is left up to the reader to
    develop another method of accommodating multi-volume archives.
(H) The examples given use cpio as the archive utility.  You may want
    to use a different archive utility in place of cpio (be sure to make
    any necessary changes to the scripts).  One such utility is tar(C).
    However, tar is not really recommended as it does not save information
    about empty directories and special files.  Tar also cannot handle
    files whose pathnames contain more than 100 characters (cpio(C) can
    handle file names less than or equal to 256 characters).
(I) Neither cpio(C) (nor tar(C) for that matter) deals sensibly with
    sparse files.   A sparse file will actually occupy more space on
    the archive than it did in the original filesystem (and will cause
    a lot of data to be passed along the net).
+----------------------------------------------------------------------+
SECTION III - Backup / Restore scenarios

(A) Backing up remote system to a tape drive on the local system.

This method describes administering backups from the system with the tape drive, thus being able to mount/unmount the tapes.

                 __________
 __________     |          |                    __________
/ keyboard |____|  locsys  |_________          |          |
|__________|    |__________|        /__________|  remsys  |
                     |                         |__________|
                    / \                             |
                   /   \                         ___|___
                  ( Tape)      <==backup==      ( remote)
                   \   /                        (  disk )
                    \_/_____                    (_______)
                   archive                        source

The following is a suggested command stream syntax:

rcmd <remsys> "cd <mntpt>; find . -depth -print | cpio -ocvB" > /dev/rct0
 |              |           |                      |          |
 |              |           |                      |   output to local tape
 |              |           |                      |   device
 |              |           |                      |
 |              |           |                put into cpio archive
 |              |           |
 |              |           \----- create list of files
 |              |
 |              \----- position to filesystem's mount point or subdirectory
 |
 \----- execute the following quoted command(s) on the remote system
(1) Backup Example
Here is an example of backing up the filesystems from remsys onto
the local system's tape drive.  You can include a bs= option to
the dd command for improved performance.  Note that in this example
the "-mount" was _not_ included so as to back up all of the mounted
filesystems.
# cd /
# umask 000
# rcmd remsys "cd /
>   find . -depth -print |
>   cpio -ocvB"  > /dev/rct0
(2) Restore Example
                 __________
 __________     |          |                    __________
/ keyboard |____|  locsys  |_________          |          |
|__________|    |__________|        /__________|  remsys  |
                     |                         |__________|
                     |                              |
                    / \                             |
                   /   \                         ___|___
                  ( Tape)      ==restore==>     ( remote)
                   \   /                        (  disk )
                    \_/_____                    (_______)
                   archive                        target

Here is an example of restoring all of the remote system's files from the local tape archive.

# cd /
# umask 000
# dd if=/dev/rct0 |
>   rcmd remsys "cd /
>   cpio -icvBdum"  < /dev/rct0
(B) Backing up to remote tape drive
                    __________                                      _
    __________     |          |                    __________      / \
   / keyboard |____|  locsys  |_________          |          |    /   \
   |__________|    |__________|        /__________|  remsys  |---( tape)
                     ___|___                      |__________|    \   /
                    ( local )     ==backup==>                      \_/___
                    (  disk )                                     archive
                    (_______)
                     source

The following is a suggested command stream syntax:

find . -depth -print | cpio -ocvB | rcmd <remsys> "dd of=<tapedev>"
 |                      |               |           |
 |                      |               |           \-- put archive on tape
 |                      |               |
 |                      |               \----- send archive to remote mach
 |                      |
 |                      \----- create cpio archive (incl directory info and
 |                                                  actual data)
 |
 \----- list all files in directory tree of current directory
(1) Backup Example
Here is an example of backing up the /dev/u filesystem from the
local system to the tape drive on remsys.  It assumes there is a
directory named /backup to back up to.  You can include a bs=
option to the dd command for improved performance.
# cd /u
# umask 000
# find . -depth -print  |
>   cpio -ocvB  |
>   rcmd remsys "dd of=/dev/rct0 bs=32k"
(2) Restore Example
                 __________                                      _
 __________     |          |                    __________      / \
/ keyboard |____|  locsys  |_________          |          |    /   \
|__________|    |__________|        /__________|  remsys  |---( tape)
                  ___|___                      |__________|    \   /
                 ( local )     <==restore==                     \_/___
                 ( disk  )                                     archive
                 (_______)
                  target
Here is an example of restoring the /u/dev filesystem on the local
system from the tape drive on remsys.  You can include a bs= option
to the dd command for improved performance.
# cd /u
# umask 000
# rcmd <remsys> "dd if=/dev/rct0 bs=32k" |
>   cpio -icvBdum
(C) Backing up local filesystem to a remote system's hard drive.
                    __________
    __________     |          |                    __________
   / keyboard |____|  locsys  |_________          |          |
   |__________|    |__________|        /__________|  remsys  |
                     ___|___                      |__________|
                    ( local )                        ___|___
                    ( disk  )      ==backup==>      ( remote)
                    (_______)                       (  disk )
                     source                         (_______)
                                                     archive

The following is a suggested command stream syntax:

find . -depth -print | cpio -ocvB | rcmd <remsys> "cd /tmp; cpio -icvBdum"
 |                      |            |                            |
 |                      |            |           "de-archive"-----/
 |                      |            |
 |                      |            \----- send this archive to remote mach
 |                      |
 |                      \----- create cpio archive (incl directory info and
 |                                                  actual data)
 |
 \----- list all files in directory tree of current directory
(1) Backup Example

Here is an example of backing up the local system's root filesystem to a subdirectory on remsys named "backup". The -mount option is included with the find command to specify to _not_ transverse any mounted filesystems.

# cd /
# umask 000
# find . -depth -mount -print  |
>   cpio -ocvB  |
>   rcmd remsys "cd /backup && cpio -icvBdum"
(2) Restore Example
                 __________
 __________     |          |                    __________
/ keyboard |____|  locsys  |_________          |          |
|__________|    |__________|        /__________|  remsys  |
                  ___|___                      |__________|
                 ( local )                        ___|___
                 ( disk  )     <==restore==      ( remote)
                 (_______)                       (  disk )
                  target                         (_______)
                                                  archive

Here is an example of restoring the local system's root filesystem from a subdirectory on remsys named "backup". The -mount option is included with the find command to specify to _not_ transverse any mounted filesystems.

# cd /
# umask 000
# rcmd remsys "cd /backup
>   find . -depth -mount -print |
>   cpio -ocvB"  |
>   cpio -icvBdum
NOTE:  Should you encounter the error message "cannot write to tty" then this
       indicates a tape problem suggesting that the tape may have run of
       capacity.
NOTE:  This approach is relevant to other operating systems such as UnixWare7,
       Open UNIX 8 and Linux.
+----------------------------------------------------------------------------+
SECTION IV. Appendix

See also

- SCO System V Operating System User's Reference: find(C), cpio(C) - SCO System V TCP/IP User's Reference manual or SCO Open Desktop/Open Server System Administrator's Guide: rcmd(TC) - Another article in this database under the tcpip category entitled "How to set up user equivalence between two systems"

From the Xinuos technical article database, record 107232. Reproduced with permission. The original is at www.sco.com/ta/107232, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.