|
|
There are a number of Unix utilities for moving files from tape to disk, disk to tape, disk to disk, and disk to CD media. This section will outline some of the basic uses of these utilities.
This chapter will cover the following information:
Following is information on the general-access tape drives available.| System | Architecture | Generic Device Name | Device Type |
| bodhi | SGI | /dev/rmt/tps5d5 | DLT 2000 |
| hop | SGI | /dev/rmt/tps3d5 | DLT 4000 |
| mmm | SGI | /dev/rmt/tps2d5 | DLT 4000 |
| pinon | SGI | /dev/rmt/tps0d2 | 4mm DAT |
| cedar | DECAlpha | /dev/rmt0h | 4mm DAT |
| thorn | Sun | /dev/rmt/1 | 4mm DAT |
| thorn | Sun | /dev/rmt/2 | 8mm Exabyte 8500 |
| hazel | Sun | /dev/rmt/0 | 8mm Exabyte 8500 |
The above device names are generic names. Depending on your application the actual device name will vary, for instance, to utilize the no rewind option on pinon the device name would be /dev/rmt/tps0d2nr. For specific information on each architecture, refer to the following man pages about the SCSI drive interfaces.
Syntax: mt -f device command countFor example, to rewind a tape, enter:
mt -f /dev/nrmt0h rewindTo skip forward five files on the tape, enter:
mt -f /dev/nrmt0h fsf 5Other useful commands to use with mt are
bsf count Move backward count files. bsr count Move backward count records. fsr count Move forward count records. eof count Write count end-of-file marks at current position on tape. status Get status of tape device.
The tape archive utility, tar, saves and restores multiple files to and from a single tape or archive file (tar file). There are various options for creating a tar file and extracting files from it.
Syntax: tar options device directoryFor a listing of a tape archive's contents, enter
tar -tv /dev/rmt0hThe actual device name will vary by machine. To list the contents of a tar archive file, enter
tar -tvf file.tarTo read a tar file from a tape device, set your default to the directory above the one that you want to restore the files to. For instance, user jones would restore files to a directory below the directory data with the following steps.
1. List the tape's contents to find the top-level directory name as shown above. 2. Enter the following. cd /user1/jones/data mkdir directory tar -xv /dev/rmt0hThe x option extracts files. The v (verbose) option lists the files to your screen as it restores them.
To write a tar file to tape, use the c (create) option. For instance, user jones can make a tar file of her entire directory with the following command:
cd /user1/jones tar -cv /dev/rmt0h .To create a tar file on disk rather than tape, first locate a disk with enough space to create the resulting .tar file. User jones would then enter:
cd /user1/jones/ tar -cvf /disk/jones/files.tar files
which would tar up the sub-directory structure files. To read a tar file from disk, set your default to the directory above the one where you want to restore the files, and enter:
tar -xvf files.tar
which would restore the files sub-directory structure.
Note: When moving tar files across the network via ftp, be
sure to use binary mode.
The dd command copies an input file to an output file. These can be either tape-to-disk or disk-to-disk copies. This command is particularly useful for I/O, as it allows you to read and write arbitrary record sizes.
Syntax: dd optionsFor example, to read an input file from a tape device to a file on disk and convert the records from variable length to fixed length in the process, enter
dd if=/dev/nrmt0h of=data conv=blockOther useful options of the dd command are
ibs Input block size (512 default). obs Output block size (512 default). skip=n Skip n records before starting to copy. files=n Skip n files before starting to copy. conv=unblock Convert fixed-length records to variable length records.
mimosa> cd /mimosa
mimosa> mkisofs -r -o difax.iso /mmmtmp/boydw/difax
mimosa> ls total 484884 -rw-r--r-- 1 boyd users 496023552 Jul 13 08:12 difax.iso
As the SCSI device will vary between systems, first issue the following: mimosa>sudo cdrecord -scanbus Substitute the appropriate numbers in the dev= option below. mimosa>sudo cdrecord -eject -v -isosize speed=8 dev=0,3,0 difax.isoWe trust you have received the usual lecture from the local System Administrator. It usually boils down to these two things: