Tape Manipulation

Data files are written to tapes in sets using the tar command. Data are written in sets because DLTs are so large it is combersome to untar an entire tape to access one or two files. Science data sets are ~4 gigabytes in size, and detrend data is written into one large set regardless of size. Here is an example of how to extract several files from tape.

Assume that after browsing the log table, we would like to extract exposures 570905 - 570918. We would first consult the manifest, which contains entries such as:


media manifest , disk media id 564, seq. 1, set 3
FILENAME-SCIENCE_DATA MEF UNPROCESSED
570900o.fits {Jan 30 2001 9:56:00:000PM}
570901o.fits {Jan 30 2001 10:09:52:000PM}
570902o.fits {Jan 30 2001 10:20:02:000PM}

...

media manifest , disk media id 564, seq. 1, set 4
FILENAME-SCIENCE_DATA MEF UNPROCESSED
570907o.fits {Jan 30 2001 10:30:12:000PM}
570908o.fits {Jan 30 2001 10:40:23:000PM}
570909o.fits {Jan 30 2001 10:50:32:000PM}

570910o.fits {Jan 30 2001 11:00:13:000PM}
570911o.fits {Jan 30 2001 11:09:52:000PM}
570912o.fits {Jan 30 2001 11:20:02:000PM}

...

570917o.fits {Jan 30 2001 11:30:12:000PM}
570918o.fits {Jan 30 2001 11:40:23:000PM}
570919o.fits {Jan 30 2001 11:50:32:000PM}

The files of interest are on Tape 1, sets 3 and 4. To extract the files:

  • Check tape 1 and confirm that the leader is showing
  • Insert the tape into the drive and note the device name of the drive, in this example we will use /dev/rmt/0n (The 'n' is for no-rewind).
  • Change to the directory you would like to extract the files to,
    eg. cd ~/mydata
  • Use the mt command to skip the first two sets on the tape.
    mt fsf 2 /dev/rmt/0n.
    Please note, the number provided after fsf is the number of sets to skip, not the set to advance to.
  • Type tar xvf /dev/rmt/0n to extract set 3.
  • At the end of this command, the tape has advanced to set 4 so there is no need to use mt to skip another set.
    Type tar xvf /dev/rmt/0n to extract set 4 and the files in those sets have been extracted to the current directory.

To extract all the files on the tape, it is necessary to run the tar command in a loop. This can be done from the command line or using a simple script such as:

#!/bin/csh
set dev = /dev/rmt/0n
mt -t $dev rewind
tar -xvf $dev
set i = 1
while (1)
 mt -t $dev rewind
 mt -t $dev fsf $i
 tar -xvf $dev
 @ i++
end
exit