LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how to determine the tape usage for a streamer? (https://www.linuxquestions.org/questions/linux-software-2/how-to-determine-the-tape-usage-for-a-streamer-627216/)

alexandrusa 03-11-2008 08:20 AM

how to determine the tape usage for a streamer?
 
Hi,

I'm making backups on a tape-drive using tar:

Code:

tar -cf /dev/st0 /somedir)
I've (or I hope I have) enabled the drive-side compression with:

Code:

mt -f /dev/st0 compression
Now I'd like to see if that had any effect. Is it possible to determine the current usage of a tape?

Alex

choogendyk 03-12-2008 06:38 AM

Do you mean how much total data can you write to it now? Well, that depends on the data. Some data is compressible, and some data is not. I've got some partitions that compress to 1/10th of their former size and others that compress to about 90% of their former size. Logs versus images.

I've typically used amtapetype (a utility that comes with Amanda) to assess a tape. It will diagnose whether you have compression on, and, with compression off will tell the total capacity and speed of the tape. It takes a long time to run. You don't need the rest of Amanda to run it, but you could install Amanda and then use that utility.

I also use server side software compression rather than the hardware compression on the drive. That gives me more control over planning what will fit on the tape. With adequate cpu, memory, and holding space on the server, that works well for me. In other situations, it might not.

alexandrusa 03-12-2008 08:31 AM

Hi choogendyk,

I actually meant to read someway the end-block of a tape that has data on it and calculate how much of the tape is used so far. I especially want to do this to be able to compare it to server-side compression, as you mentioned.

How much should fit on the tape without compression should be written on it.. is there a reason to doubt that info?

Alex

choogendyk 03-12-2008 07:04 PM

I'm not clear on your last question.

You can certainly get to the end of written data with `mt eom` (end of media). But I don't know that you can tell where you are, how much you passed over to get there, or how much space is left.

The tools like amtapetype treat the tape as a black box. Throw data at it as fast as you can for as long as you can. Record how fast it accepts the data, and record the point at which it throws up its hands and says it can't take anymore. Do that with easily compressible data. Do it with uncompressible data. Compare notes and determine whether the tape is compressing (actually, you can diagnose that in some other ways too, by comparing the speed it takes data between those two cases).

So, I think the only way you can know the behavior, capacity, and compression performance of your tape drive is by doing the same sorts of things. Use dd to throw large quantities of data at it, and/or use a utility like amtapetype.

alexandrusa 03-13-2008 05:30 AM

Quote:

Originally Posted by choogendyk (Post 3086816)
I'm not clear on your last question.

I was reffering to:

Quote:

Originally Posted by choogendyk
with compression off will tell the total capacity and speed of the tape

I only meant that I should know how much fits on the tape with compression off.

Quote:

Originally Posted by choogendyk (Post 3086816)
But I don't know that you can tell where you are, how much you passed over to get there, or how much space is left.

Thats what I wanted to find out.

Quote:

Originally Posted by choogendyk (Post 3086816)
The tools like amtapetype treat the tape as a black box. Throw data at it as fast as you can for as long as you can. Record how fast it accepts the data, and record the point at which it throws up its hands and says it can't take anymore.

Well I guess that's the only option if my first thought isn't possible, but it'll take loooooong time..

Thanks for your help!

Ammad 10-01-2008 11:45 AM

i have same problem , "to know space left on Tape" i am using LT03. i wrote a script that will list the contents and Total space + used space on Tape.
check this and let me know if you have some problems.
thanks

Code:


#!/bin/bash

export TAPE=/dev/nst0
export h=0
clear
echo
echo
echo "                          Listing backup on Tape  "
echo
echo
echo
echo

/bin/mt -f $TAPE rewind
BLOCKS=`/bin/mt -f /dev/nst0 status | grep bits | awk '{print $5}'| tr -d "(" | tr -d ")" | tr -d ":"`
/bin/mt -f $TAPE eod
echo -n  " Total block  on  current Tape : $BLOCKS    / "
echo $(($BLOCKS/102400)) GB
BLOCKSL=`/bin/mt -f /dev/nst0 status | grep bits | awk '{print $5}'| tr -d "(" | tr -d ")" | tr -d ":"`
echo
echo
echo
echo -n  " Total block on used current Tape : $BLOCKSL  / "
echo $(($BLOCKSL/102400)) GB
echo
echo
lastcount=`/bin/mt -f $TAPE status | grep -i file | awk '{print $2}'| tr -d "number=" | tr -d ","`
/bin/mt -f $TAPE rewind
while [ $h -le $lastcount  ]
do
echo -n  "    $h : "
tar tvf $TAPE  | awk '{print $6}'
h=$((h+1))

if [ $h -eq $lastcount ]; then
 exit
else
/bin/mt -f $TAPE fsf 1
fi
done
echo
echo
echo  Report bugs @ "mammadshah@hotmail.com "
echo  License GNU/GPL



All times are GMT -5. The time now is 04:37 AM.