SUMMARY: How to determine the amount of space left on a tape.

From: Sheldon Lee Wen (sheldon.leewen@cgi.com)
Date: Sun Oct 06 2002 - 02:23:57 EDT


Sorry this Summary is so late. Many thanks to everyone who responded.
Typically the responses were that this is a non-trival problem (which is
what I had expected, but I was hoping that someone had solved it
already). I’ve included the responses that cover most of the replies.
 
 
Original question:
 
Does anyone know how to determine the amount of space is left on a tape
(and conversely how much is used?).
 
 
Answers:
 
Dr Thomas Blinn:
 
Totally non-trivial problem.  It used to be easy (when tape drives were
simple and didn't do things like data compression and streaming).
 
You can use the "tapex" utility (part of the "System Exercisers", see
the reference page) with the "-m" option to get a report of the number
of records (and sizes) in each file, and the number of files, but it
won't tell you how much more data you could write on the tape.  To get a
sense of that, you need to experiment (at least, with most modern tape
drives), by actually writing real data with a real program. 
 
If you have a streaming tape drive (most modern SCSI tape drives are
streaming drives) but you can't keep the buffer full, you'll wind up
with a much lower recorded data density.  If you have a drive that does
data compression, and you feed it data that doesn't compress very well
(e.g., JPG images that are already compressed, the .mod files from your
/sys/BINARY directory that are mostly compressed, or any other
compressed data, such as ZIP files), then you won't get as much data
recorded (as measured by on-disk byte counts) than if you feed it data
(such as most text files) that's highly compressible.
 
 
Peyton Bland:
 
>   Does anyone know how to determine the amount of space is left on a
>tape (and conversely how much is used?).
 
I hope someone else can give you a better answer.  If not, here's how
we've estimated this in our lab...
 
* Our 35/70 GB DLT tapes seem to hold about 57GB before filling up.
 
* The tapex command (in /usr/field) shows that out drive has a block
size of 61,440 bytes.
 
* At the end of a backup (before rewinding), issue the "mt rdpos"
command to get tape position.
 
>From these things, we can estimate our tape usage.  Not great but better
than nothing...
 
 
Simon Millard:
 
With compression, the contents of a file will usually determine how
compressed the resulting output would be and this could change.  On an
DLT IV tape, I managed to get 100Gb which is a lot more that the spec
could.
 
If you are using vdump, then the output will tell you how much data has
been written to tape.  With a bit of playing around with a non-rewind
device, you can experiment to see how much space is left.
 
Key Tip,  always ensure that you tape drives have capacity.  Using an
autoloader is an easier way to put large volumes onto multiple tapes.
 
If you are using vdump, you can see what the maximum size of the data is
going to be, du/df will tell you this, so If you are writing scripts, if
you need to split the backups, make sure that the file systems will fit.
I always put / and /usr on the first tape, and in that order in case I
have to do a restore.
 
Jim Belonis:
 
The only way is to keep track of the amount you have written.
 
You can not, e.g. insert a tape that has already been written on and ask
the tape drive to tell you how much has been written without reading the
whole tape.
 
The tape drive keeps track of how much it has written
since the last tape insertion and there are SCSI commands you can send
to it to find out how many tape blocks have been written and what
compression ratio has been actually achieved during the current
insertion session.
 
Knowing how much 'space' is left on a tape is really quite hard when the
tape drive compresses with a variable efficiency depending on the
content of the files to be written.
 
Peter Gergen:
 
The answer is to continually write to the tape in 64k blocks until you
get an error indicating
that the media is at the EOM (end of media) state. Do a quick
calculation based on the number of 64k write successfully done and that
is the answer as to how much data can fit on the tape.
 
While writing to the tape now when doing a backup, keep a count of how
much data has been written to tape and subtract that from the figure you
got when the test above was done and this is the
remaining tape capacity.
 
Note that it is wise to anything around 100MB-500MB less than the test
value achieved as a safe value
to use as a general tape size value as tapes do vary especially with
general wear.
 
 
Sheldon Lee Wen
Ottawa Data Center, UNIX Services
Phone: 613-740-5900 ext 5363
Pager: 613-780-7281
Email: Sheldon.leewen@cgi.com 



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:48:55 EDT