Creating a remote archive

Use this procedure to archive files to a remote tape device.

Running AIX® systems cannot mount a remote tape device as if it were local to the system; however, data can be sent to a remote machine tape device using the rsh command. The following procedure writes to a single tape only. Multiple-tape archives require specialized application software.

In the following procedure, assume the following:
blocksize
Represents the target tape device blocksize.
remotehost
Is the name of the target system (the system that has the tape drive).
sourcehost
Is the name of the source system (the system being archived).
/dev/rmt0
Is the name of the remote tape device
pathname
Represents the full pathname of a required directory or file.
When using the following instructions, assume that both the local and remote user is root.
  1. Ensure you have access to the remote machine.
    The source machine must have access to the system with the tape drive. (The target system can be accessed using any of the defined users on that system, but the user name must have root authority to do many of the following steps.)
  2. Using your favorite editor, create a file in the / (root) directory of the target system called .rhosts that allows the source system access to the target system.
    You need to add the authorized host name and user ID to this file. To determine the name of the source machine for the .rhosts file, you can use the following command:
    host SourceIPaddress
    For the purposes of this example, assume you add the following line to the .rhosts file:
    sourcehost.mynet.com   root
  3. Save the file and then change its permissions using the following command:
    chmod 600 .rhosts
  4. Use the rsh command to test your access from the source machine. For example:
    rsh remotehost
    If everything is set up correctly, you should be granted shell access to the remote machine. You should not see a login prompt asking for a user name. Type exit to log out of this test shell.
  5. Decide on the appropriate tape device blocksize.
    The following are the recommended values:
    Item Description
    9-track or 0.25-in. media blocksize: 512
    8-mm or 4-mm media blocksize: 1024

    If you are unsure and want to check the current block size of the tape device, use the tctl command. For example:

    tctl -f /dev/rmt0 status

    If you want to change the tape blocksize, use the chdev command. For example:

    chdev -l rmt0 -a block_size=1024
  6. Create your archive using one of the following methods:
    Backup by Name
    To remotely create a backup archive by name, use the following command:
    find pathname -print | backup -ivqf- | rsh remotehost \
        "dd of=/dev/rmt0 bs=blocksize conv=sync"
    Backup by inode
    To remotely create a backup archive by inode, first unmount your file system then use the backup command. For example:
    umount /myfs
    backup -0 -uf- /myfs | rsh remotehost \
         "dd of=/dev/rmt0 bs=blocksize conv=sync"
    Create and Copy an Archive to Remote Tape
    To create and copy an archive to the remote tape device, use the following command:
    find pathname -print | cpio -ovcB | rsh remotehost \
        "dd ibs=5120 obs=blocksize of=/dev/rmt0"
    Create a tar Archive
    To remotely create a tar archive, use the following command:
    tar -cvdf- pathname | rsh remotehost \
        "dd of=/dev/rmt0 bs=blocksize conv=sync"
    Create a Remote Dump
    To remotely create a remote dump of the /myfs file system, use the rdump command:
    rdump -u -0 -f remotehost:/dev/rmt0 /myfs
    The -u flag tells the system to update the current backup level records in the /etc/dumpdates file. The -0 is the setting of the Level flag. Backup level 0 specifies that all the files in the /myfs directory are to be backed up.
  7. Restore your remote archive using one of the following methods:
    Restore a Backup by Name
    To restore a remote backup archive by name, use the following command:
    rsh remotehost "dd if=/dev/rmt0 bs=blocksize" | restore \
         -xvqdf- pathname
    Restore a Backup by inode
    To restore a remote backup archive by inode, use the following command:
    rsh remotehost "dd if=/dev/rmt0 bs=blocksize" | restore \
        -xvqf- pathname
    Restore a Remote cpio Archive
    To restore a remote archive created with the cpio command, use the following command:
    rsh remotehost "dd if=/dev/rmt0 ibs=blocksize obs=5120" | \
         cpio -icvdumB 
    Restore a tar Archive
    To restore a remote tar archive, use the following command:
    rsh remotehost "dd if=/dev/rmt0 bs=blocksize" | tar -xvpf- pathname
    Restore a Remote Dump
    To restore a remote dump of the /myfs file system, use the following command:
    cd /myfs
    rrestore -rvf remotehost:/dev/rmt0