gabriel rosenkoetter on Fri, 20 Dec 2002 20:01:07 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] tar and tape problem


On Wed, Dec 18, 2002 at 09:15:19AM -0800, Marc Zucchelli wrote:
> I would like to make sure the tape is rewound
> before I write to it obviously, whenever I run mt
> rewind, it returns me to the shell prompt right away. 
> How would I know if the tape is actually still
> rewinding before I make the call to tar?

mt won't return until it's finished the operation.

Unless you're using the tape drive's no-rewind minor device number,
it rewinds after every option.

So make sure you're using the no-rewind device if you don't want to
overwrite the partitions you just wrote. (This is one of those
gotchas that make it a Really Good Idea to test *restores* before
you put a backup system into production.)

> How can I make my
> script know if the tape is actually ready to be
> written to, and rewound?

mt -f <device> status and parse the output. Or do it once, sleep 3
and do it again (kind of seat of the pants flying, but the first
will wait to return a "NOT READY" till the device actually *is*
ready, and the second *should* return instanteously if your tape
drive's not broken).

-- 
gabriel rosenkoetter
gr@eclipsed.net

Attachment: pgpv7LPGZE4Gk.pgp
Description: PGP signature