## 38.7. Using tar to a Remote Tape Drive

If your computer doesn't have a tape drive connected, creating tar (Section 38.2) backup files is slightly more complicated. If you have an account on a machine with a tape drive, and the directory is mounted via NFS (Section 1.21), you can just rlogin (Section 1.21) to the other machine and use tar to back up your directory.

If the directory is not NFS mounted, or it is mounted but you have permission problems accessing your own files, you can use tar, rsh (Section 1.21), and dd (Section 21.6) to solve this dilemma. The syntax is confusing, but if you forget, you can use man tar (Section 2.1) to refresh your memory. The command to dump the current directory to a tape in a remote machine called zephyrus is:

>     % tar cvfb - 20 . | rsh zephyrus dd of=/dev/rmt0 obs=20b

Here, the output file of tar is `-`, which tar interprets as standard input if tar is reading an archive or standard output if tar is creating an archive.

The dd command copies data from standard input to the device /dev/rmt0.

This example assumes you can use rsh without requiring a password. You can add your current machine's name to the remote .rhosts file (Section 1.21) if you get a `Password`: prompt when you use rlogin to access this machine. You also can use ssh, which is generally more secure than rsh, and the ssh-agent utility to allow logins without a password.

-- BB

Copyright © 2003 O'Reilly & Associates. All rights reserved.