| Machine | Device Name | Default Dev. | Tape Type | Tape Size |
| Squid |
/dev/exabyte /dev/exabytenr |
NONE | Exabyte 8mm | 2 Gigabytes |
| Grizzly |
/dev/exabyte /dev/exabytenr |
/dev/exabyte | Exabyte 8mm | 2 Gigabytes |
| Dugout |
/dev/tape /dev/tapenr |
/dev/tape |
1/4" D6150 1/4" D600A |
150 Megabytes 60 Megabytes |
In the table above, two drive names are listed for each machine. If you use the first drive name the tape will automatically rewind to the beginning after it performs your operation. Using the second drive name (the nr version) will tell the drive not to rewind after your operation. However, you will almost always want to use the first drive name, the rewinding version.
Other useful commands under Unix for dealing with tapes are cpio and dd. Of these, dd is mentioned briefly in this document and cpio is not addressed.
tar [ - ] c|r|t|u|x [ bBefFhilmopvwX014578 ] [ tarfile ]
[ blocksize ] [ exclude-file ] [ -I include-file ]
filename1 filename2 ... -C directory filenameN ...
Type man tar for more detailed information.
To create (which you can think of as copying) verbosely the directory 'temp' on the default device, which is usually the tape device:
grizzly% tar cv temp
To create the current directory on file(or device in this case) /dev/exabytenr (an exabyte tape drive which will not rewind.):
squid% tar cf /dev/exabytenr .
To create verbosely the directories /usr1/scv/jack and /usr1/scv/jill, and the file smit.log on the file backup.tar (assumed to be done while in the root directory such as after typing cd /):
squid% tar cvf backup.tar usr1/scv/jack usr1/scv/jill smit.log
To list the table of contents on the tape drive on squid (very useful):
squid% tar tf /dev/exabyte
To extract verbosely all the files on the default device which is usually a local tape drive:
grizzly% tar xv
To extract all the files in ~jack/backup.tar. Tar will not display what it is doing:
squid% tar xf ~jack/backup.tar
As above, to extract all the files in ~jack/backup.tar but doing it in an alternate way using cat and a pipe(|). Also the verbose option has been turned on so tar will let you know what is happening:
squid% cat ~jack/backup.tar | tar xvf -
If you have multiple tar archives on a single tape, extracting files is
somewhat more cumbersome.
To extract the entire third tar archive on a tape in Squid's drive, do
the following. The mt command tells the drive to go forward 2 tape
archives and then not rewind. After that you can simply extract the files.
Type man mt for more information on this
tape manipulating program.
squid% mt -f /dev/exabytenr fsf 2
squid% tar xvf /dev/exabyte
The following command 1)Tars up /usr1/scv/jack, /scratch, and /scratch2; 2)Pipes the output to compress; and 3)Redirects the output to the file 'file.tar.Z'. The - symbol in the place of a file name causes tar to write to standard output (the screen if not for the pipe symbol [ | ]) rather than to a file or device.
squid% tar cvf - usr1/scv/jack scratch scratch2 | compress > file.tar.Z
The following command will uncompress the tar archive ~jack/file.tar.Z; cd to /scratch/jack and extract verbosely all the files in the archive. The result will be that all the files in the compressed archive file.tar.Z will be extracted into the directory /scratch/jack.
squid% zcat ~jack/file.tar.Z | (cd /scratch/jack; tar xvf -)
The following command will copy the files from the directory usr1/scv/jack on
the local host and extract them verbosely into cgl's /scratch/jack
directory. You would need to do something like this if you wished to backup
files on a different machine than the tape drive is on. For this command
or any command using rsh to work, you must have a .rhosts file
setup on the remote machine allowing access from the local machine (user
jack would need a .rhosts file on cgl with a line
squid% tar cBf - usr1/scv/jack | rsh cgl '(cd /scratch/jack; tar xvBf -)'
To copy the directory ~jack onto grizzly's tape device using dd, use the following command. This command is appropriate for when your files are on one machine but the tape drive is on a different machine. Note that dd is somewhat architecture-dependent. If you have problems, ask the consultant in the Computer Graphics Lab for help or send mail to help@cgl.bu.edu.
cgl% tar cBvf - ~jack | rsh grizzly dd bs=20b of=/dev/tape
To extract the source files from the tar file created in the previous command into the correct directory do the following. Use this command when you wish to extract files onto a machine different from the machine with the tape drive.
cgl% rsh grizzly 'dd bs=20b if=/dev/tape' | tar xvBf -
To write a third tar archive onto a tape that already has two archives on it (on Grizzly):
grizzly% mt -f /dev/exabytenr fsf 2 (Go forward 2 EOF's. Don't rewind.)
grizzly% tar cvf /dev/exabytenr file1 dir1 (Tar file1 + dir1 onto tape).
grizzly% tar tv (List files and directories on default device (tape))
tmp
tmp/jay.gif
tmp/jay.ps
etc
etc/motd
grizzly% tar xv tmp/jay.gif (Extract file jay.gif.)
OR
grizzly% tar xv tmp (Extract directory tmp (including jay.gif and jay.ps.))
OR
grizzly% tar xv tmp/jay.ps etc (Extract file jay.ps and directory etc)