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 blocksizeSetting 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
- Decide on the appropriate tape device blocksize (bs). Recommended values are as follows:
- To check the current blocksize of the tape device, enter:
- To change the tape device blocksize, enter:
8mm or 4mm = 1024
Other high capacity drives often have optimal blocksize = 0
tctl -f /dev/rmt0 status
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
- 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.
- 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. - Add the following line to the file:
- Save the file.
- Change the permissions on the .rhosts file by entering:
<src_host_name> root
<src_host_name> is the system name determined in
step 2.
chmod 600 .rhosts
On the source machine
- 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:
- Type exit to log out.
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.
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
- To remotely create a backup archive by name, enter:
- 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>
find <path> -print | backup -ivqf- | rsh
<t_mach> \
"dd of=/dev/rmt0 bs=<bs> conv=sync"
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.
- To remotely create a backup archive by inode, enter:
- To restore a backup archive by inode created as in the preceding example, enter:
umount <filesystem>
backup -0 -uf- <filesystem> | rsh
<t_mach>\
"dd of=/dev/rmt0 bs=<bs> conv=sync"
rsh <t_mach> "dd if=/dev/rmt0 bs=<bs>"
| restore \
-xvqf- <path>
cpio
- To remotely create an archive using cpio, enter:
- To restore a cpio archive created as in the preceding example, enter:
find <path> -print | cpio -ovcB | rsh
<t_mach>\
"dd ibs=5120 obs=<bs> of=/dev/rmt0"
rsh <t_mach> "dd if=/dev/rmt0 ibs=<bs>
obs=5120" | \
cpio -icvdumB <path>
tar
- To remotely create an archive using tar, enter:
- To restore a tar archive created as in the preceding example, enter:
tar -cvdf- <path> | rsh <t_mach> "dd
of=/dev/rmt0
bs=<bs> conv=sync"
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-"
Historical Number
isg1pTechnote0540
Was this topic helpful?
Document Information
Modified date:
17 June 2018
UID
isg3T1000327