Creating an Archive to a Remote Device


Contents

About This Document
Tape Blocksize
Setting Up the .rhosts File
    On the Target Machine
    On the Source Machine
Archive Commands
    Backup by Name
    Backup by Inode
    cpio
    tar
    rdump
Moving a File System Remotely

About This Document

Some UNIX systems have the capability of referencing a remote tape device as if it were local to the source system. Running AIX Systems cannot "mount" a remote tape device locally; however, data can be sent to a remote machine tape device using rsh.

This document describes how to archive files to a remote tape device. Information in this document is valid for AIX Versions 3.2.5 through 4.2.

IMPORTANT NOTE: The dd command WILL NOT span tapes. Multiple tape archives are not available via this procedure.


Tape Blocksize

  1. Decide on the appropriate tape device blocksize (bs). Recommended values are as follows:
  2.                9trk or 1/4in   = 512
                   8mm or 4mm      = 1024
    
  3. To check the current blocksize of the tape device, enter:
  4.                tctl -f /dev/rmt0 status
    
  5. To change the tape device blocksize, enter:
  6.                chdev -l rmt0 -a block_size=<bs>
    
    Replace <bs> with the value that you want to assign.

Setting Up the .rhosts File

In order to create a remote archive, the system being archived (the source machine) must have access to the system with the tape drive (the target machine). The target system can be accessed using any of the defined users on that system, but the following examples assume that both the local and remote user is root. For further information on rsh and user authentication, please see the rsh man page or InfoExplorer.

On the Target Machine

  1. As root, using a favorite editor, create a file in the / directory called .rhosts that allows the source system access to the target system.
  2. To determine the name of the source machine to be added to the file, run the following command:
                   host <src_host_IP>
    
    <src_host_IP> is the IP address of the source system.
  3. Add the following line to the file:
  4.                <src_host_name> root
    
    <src_host_name> is the system name determined in step 2.

  5. Save the file.
  6. Change the permissions on the .rhosts file by entering:
  7.                chmod 600 .rhosts
    

On the Source Machine

  1. Once the .rhosts file is set up on the target system, test to be sure the source system has access. On the source system, as root, enter:
  2.                rsh <target_machine>
    
    <target_machine> is the name of the target host. Shell access should be granted; no login prompt asking for a username should appear.

  3. Type exit to log out.

Archive Commands

The following are examples of how to use AIX archive commands to a remote tape drive. In these examples, <bs> represents the target tape device blocksize, <t_mach> is the name of the target system, and /dev/rmt0 is used as an example of the remote tape device. The <path> parameter is used where a directory or file name is needed. For more information, please see each archive command's man page or InfoExplorer.

Backup by Name

  1. To remotely create a backup archive by name, enter:
  2.                find <path> -print | backup -ivqf- | rsh <t_mach> \
                         "dd of=/dev/rmt0 bs=<bs>"
    
  3. To restore a backup archive by name created as above, enter:
                    rsh <t_mach> "dd if=/dev/rmt0 bs=<bs>" | restore \
                       -xvqdf- <path>
    

Backup by Inode

WARNING:The backup by inode documentation states that the source file system MUST be unmounted before archiving. Even though it might sometimes work without unmounting, such usage is NOT supported.

  1. To remotely create a backup archive by inode, enter:
  2.                umount <filesystem>
                   backup -0 -uf- <filesystem> | rsh <t_mach>\
                        "dd of=/dev/rmt0 bs=<bs>"
    
  3. To restore a backup archive by inode created as above, enter:
  4.                rsh <t_mach> "dd if=/dev/rmt0 bs=<bs>" | restore \
                          -xvqf- <path>
    

cpio

  1. To remotely create an archive using cpio, enter:
  2.                find <path> -print | cpio -ovcB | rsh <t_mach>\
                      "dd ibs=5120 obs=<bs> of=/dev/rmt0"
    
  3. To restore a cpio archive created as above, enter:
  4.                rsh <t_mach> "dd if=/dev/rmt0 ibs=<bs> obs=5120" | \
                         cpio -icvdumB <path>
    

tar

  1. To remotely create an archive using tar, enter:
  2.                tar -cvdf- <path> | rsh <t_mach> "dd of=/dev/rmt0 
    bs=<bs>"
    
  3. To restore a tar archive created as above, enter:
  4.                rsh <t_mach> "dd if=/dev/rmt0 bs=<bs>" | tar -xvpf- 
    <path>
    

rdump

At AIX Version 4.2 and subsequent versions, rdump includes the -L flag. This flag specifies the length of tape in bytes. For example, for a 2GB tape, use -L 2g.

At versions prior to AIX 4.2, rdump requires the use of the -s (tape length) and -d (density) flags for devices other than 9-track tape. Suggested values are:

         Size/Type    | Size used | -c option | -d flag | -s flag
         ------------- ----------- ----------- --------- ----------
         1/4" tape
         ----------------------------------------------------------
         QIC-120      |  120 mb   |    yes    |  1250   |    8800
         QIC-150      |  150 mb   |    yes    |  1250   |   10600
         QIC-525      |  525 mb   |    yes    |  2000   |   22000
         QIC-1000     |  1.2 gb   |
         ----------------------------------------------------------
         8mm tape
         ----------------------------------------------------------
         2.3gb        |  2.2 gb   |    no     |  1280   |  158596
         5.0gb        |  4.9 gb   |    no     |  1280   |  353240
         7.0gb        |  6.9 gb   |    no     |  1280   |  497420
         ----------------------------------------------------------
         4mm tape
         ----------------------------------------------------------
         2.0gb        |  1.9 gb   |    no     |  1280   |  136972
         4.0gb        |  3.9 gb   |    no     |  1280   |  281152
  1. To remotely create an rdump tape, enter:
  2.      rdump -0 -u -s<s_value> -d<d_value> -f <t_mach:/dev/rmt0> \
             <filesystem>
    
  3. To restore an rdump tape created as above, enter:
  4.      rsh <t_mach> "dd if=/dev/rmt0 bs=<bs>" | restore \
             -xvqf- <path>
    

Moving a File System Remotely

One of the easiest methods of moving an entire file system across a network while preserving permissions, UIDs, and GIDs is to use the tar and rsh commands. By invoking a tar command on the local system that writes the created archive to STDOUT, and redirecting that archive output to STDIN of an extracting tar command running on the remote system, no temporary file is created.

From the source system, enter:

           tar -cvf- <path> | rsh <t_mach> "cd <path>\
                  tar -xvf-"


Creating an Archive to a Remote Device: archive.remote.325-42.bak ITEM: FAX
Dated: 98/09/29~00:00 Category: bak
This HTML file was generated 99/06/24~12:41:56
Comments or suggestions? Contact us