StoreEver Tape Storage
cancel
Showing results for 
Search instead for 
Did you mean: 

determining free space on tape under Linux

SOLVED
Go to solution
Shaun Malone
Occasional Contributor

determining free space on tape under Linux

Hi all,

Does anyone know how to check how much space remains on a tape under Linux?

I'm using an Ultrium 460 SCSI drive with 400GB tapes (at 2:1 compression ratio) - under Fedora Core 3.

The drive uses hardware compression, so I don't know how to figure out how much space is left on the tape after doing a "tar cvf" to it.

I've done a lot of searching on this subject but haven't stumbled across anything yet.

Maybe some kind of magic calculation using block counts?

Any ideas would be most appreciated!

Thanks,
Shaun Malone
www.multimap.com
8 REPLIES
Ivan Ferreira
Honored Contributor

Re: determining free space on tape under Linux

There is no command to find out the free space on a tape.

I think that the only way is to generate a sort of catalog. Let's say, after the backup you should at least run the tvf to verify if the backup was sucessful, the outpub you can save to a file and sum the bytes for all the files.

There are other ways of course to make the catalog, using find for example before the backup, and using the output as input for the backup command.

Also, you cannot predict how much data will fit in the free space, because the compression ratio is variable.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Shaun Malone
Occasional Contributor

Re: determining free space on tape under Linux

Thanks very much for your quick reponse!!

I know how much data I am putting onto the tape - 70GB uncompressed in this instance - but since the compression is done in hardware I can't tell how much of the tape is actually being used / remains.

Ivan Ferreira
Honored Contributor

Re: determining free space on tape under Linux

Of course, the catalog is usefull only if you have mutiples backups on the same tape media, otherway, a simple df, du is enough rith? ;).
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Shaun Malone
Occasional Contributor

Re: determining free space on tape under Linux

That's true, I want to append more backups to the tape since I imagine each one is only using about 10% of its capacity - but I need a more accurate idea of how much physical space the backups are taking.

I suppose I could keep doing backups until one fails due to lack of tape space - but that seems a bit messy.

Cheers
Shaun
Ivan Ferreira
Honored Contributor

Re: determining free space on tape under Linux

The tar and dump commands can continue a backup in a different media. So, i think that won't be too bad, if you fill a tape, you'll be prompted to insert a new one.

But remember that having lots of backups on the same media is not always a good idea, if you loss the media, you loss all your backups.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Aco Blazeski
Regular Advisor
Solution

Re: determining free space on tape under Linux

Hi Shaun,

If I understood well, maybe the following will help:

1. make a tar -tvf on the last archive you have on the tape, using non-rewind device (or using the mt command forward the tape to the last eof)

2. using the mt command read the position of tape (this will give you the current block number)

3.if you know the capacity of tape then you'll now how much space is left on the tape (last - current block number)

I have no much experience with tape on linux, but above work on tru64.

I think that on linux you will use mt command with eod and tell subcommands.

However even if you know how much space left on tape , this is just to estimate how much data you can put. This because, as said before, the compression is variable.

Regards,
Richard Bickers
Trusted Contributor

Re: determining free space on tape under Linux

Hi Shaun,

Another way is to use HP Library and Tape Tools (LTT) though it only officially supports Red Hat at the moment (SuSE coming soon). With LTT you can pull the logs from the drive and see; (a) how much space is left on tape and (b) what your recent compression ratio has been. This works best if you pull the logs immediately after the backup.

The logs are best in the HP Ultrium drives which is what you've got so that should be OK.

You can find LTT at www.hp.com/support/tapetools. Select 'support' and 'view support ticket'. Fingers crossed it works for your version of Linux.

If you need help running it then please let me know. There is help on the web.

In future (next few months) LTT will support SuSE and also have clearer log decode for exactly this purpose.

Richard.
It's more interesting when it's gone wrong
Stuart Whitby
Trusted Contributor

Re: determining free space on tape under Linux

If Richard's LT&T tools option doesn't work for you, you'll also need to bear in mind with Aco's that you'll need to know your tape blocksize and check the number of blocks used for each filemark on tape. You might be able to do this with the info from:

mt -f fsf 1
mt -f bsr 1
mt -f status
mt -f fsf 2
mt -f bsr 1
mt -f status

from a newly loaded tape until the fsf fails.

Otherwise, there's no way to do this. 2:1 is just the average compression ratio that you'll get, but I've seen over 1000:1 on empty databases and about 1.05:1 on compressed graphics files, so it depends on the type of data that you're putting into the backup.

However, with compression, looking at the amount of free space on tape is fairly arbitrary anyway. With an unknown compression ratio, it's near impossible to tell whether the next lot of data will fit onto a tape unless it'll fit uncompressed.

Cheers,

Stuart.
A sysadmin should never cross his fingers in the hope commands will work. Makes for a lot of mistakes while typing.