Tech Support > Operating Systems > Linux / Variants > SCSI Tape question: How can I find out how much space is left onthe tape?
SCSI Tape question: How can I find out how much space is left onthe tape?
Posted by Jim Power on July 15th, 2003


SCSI Tape question: How can I find out how much space is left on the tape?

Thanks,
-Jim

Posted by davide@yahoo.com on July 15th, 2003


Jim Power <jim.power@atip-usa.com> wrote:
Well, if you use compressions, basically you can't. If you don't use
compressions, you should be able to establish how much data you put
on the tape and so how much should be left. But why bother? If the
data fits...

Davide

Posted by tony@aplawrence.com on July 15th, 2003


Jim Power <jim.power@atip-usa.com> wrote:
If you have a newer tape drive, it will tell you all that
and more with the appropriate ioctl call. I'm sure you can
find other ways to do that, but Microlite Edge
(http://www.microlite.com) and I'm sure other products provide
a simple interface.

For older tapes, generally something like "tape amount" (some OSes) or
mt may have options to give you the present amount written or
the block position, from which you can work backwards.

--
tony@aplawrence.com Unix/Linux/Mac OS X resources: http://aplawrence.com
Get paid for writing about tech: http://aplawrence.com/publish.html


Posted by Kevin on July 15th, 2003


In article <vJOdnehsvabHiomiXTWJiw@fcc.net>,
Jim Power <jim.power@atip-usa.com> writes:
Good question! I'm also a tape user, and I haven't thought much
about that. Here's a guess at a recipe.

mt -f /dev/n<yourdevice> ; be sure to use the "n" no-rewind device

loop on this:

mt -f /dev/n<yourdevice> fsf 1 ;
echo $?

The above should step through the files on the tape without
rewinding, and the exit status should tell you when there are no
more files. Keep track of the number of files that were on the
tape. At that point write new data to the tape with 'dd' until
the tape is full. 'dd' should report the number of bytes it
wrote; that's how much space was left on your tape. You can then
fsf to the beginning of that junk data and write away.

G'luck...


--
Unless otherwise noted, the statements herein reflect my personal
opinions and not those of any organization with which I may be affiliated.

Posted by Robert Heller on July 15th, 2003


Jim Power <jim.power@atip-usa.com>,
In a message on Tue, 15 Jul 2003 11:02:31 -0400, wrote :

JP> SCSI Tape question: How can I find out how much space is left on the tape?

Basically you can't. This is the nature of all tape drives. This is
*especially* true of compressing tape drives -- the rate of compression
is data dependent. That is some files compress more than others. If a
tape drive is 12/24 gigs (typical DDS-3 DAT), this means that the tape
has a capacity of 12 gigs uncompressed and *about* 24 gigs compressed.
The 2:1 compression ratio is 'typical' for LZW-type compression for
'typical' text files. Files that are already compressed and many
binary type files don't compress as well. Some pathologically
'extreme' text files (such as a file with vast amounts of repeated text
or repeated character sequences) will compress much better. So, a
DDS-3 DAT might run out a space after backing up 12 gigs worth of
compressed TIFF files and might also store 30gigs of really bad
(boring and repetitive) Rap lyrics as text files...

JP>
JP> Thanks,
JP> -Jim
JP>
JP>






Posted by Robert E A Harvey on July 15th, 2003


Jim Power <jim.power@atip-usa.com> wrote in message news:<vJOdnehsvabHiomiXTWJiw@fcc.net>...
You don't say what type of tape or drive, but in my experience using
the generic st driver - basically you can't.

You _can_ use the mt command to do some basic manipulation, find out
where the tape is positioned in terms of file numbers - which may mean
something to you if your files are a known size. you _can_ use tar
-tvf to list the contents, and try to guess how much space they take
up, and thence what is left.

But, in general - you can't

<<stands back to be flamed with things I have taken 20 years not to
discover>>


Similar Posts