IBM Support

Creating an Archive to a Remote Device

Question & Answer


Question

Creating an Archive to a Remote Device

Answer

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 all AIX Versions 4 and 5.

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

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
Moving a file system remotely

Tape blocksize

  1. Decide on the appropriate tape device blocksize (bs). Recommended values are as follows:
  2.                8mm or 4mm      = 1024
                   Other high capacity drives often have optimal blocksize = 0
    
  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 / (root) 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> conv=sync"
    
  3. To restore a backup archive by name created as in the preceding example, 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> conv=sync"
    
  3. To restore a backup archive by inode created as in the preceding example, 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 in the preceding example, 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> conv=sync"
    
  3. To restore a tar archive created as in the preceding example, enter:
  4.                rsh <t_mach> "dd if=/dev/rmt0 bs=<bs>" 
    | tar -xvpf- 
         <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-"

[{"Product":{"code":"SWG10","label":"AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Attached devices","Platform":[{"code":"PF002","label":"AIX"}],"Version":"5.3;5.2;5.1;4.3","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}},{"Product":{"code":"SWG10","label":"AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Installation- backup- restore","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Historical Number

isg1pTechnote0540

Document Information

Modified date:
17 June 2018

UID

isg3T1000327