Linux – How to troubleshoot tape backup issues via mt on Linux for Windows backups

backuplinuxtapetapedrivewindows-server-2003

I have an HP Ultrium 448 tape backup that is being recognized without seeming issue on Ubuntu. I am able to see it at /dev/st0.

When I issue mt -f /dev/st0 offline, the tape ejects. When I issue mt -f /dev/st0 status, I get:

SCSI 2 tape drive: 
File number=0, block number=0, partition=0. 
Tape block size 0 bytes. Density code 0x42 (LTO-2). 
Soft error count since last status=0 
General status bits on (41010000):  
 BOT ONLINE IM_REP_EN

When I issue tar -tzf /dev/st0, I get:

tar (child): /dev/st0: Cannot read: Cannot allocate memory
tar (child): At beginning of tape, quitting now
tar (child): Error is not recoverable: exiting now

gzip: stdin: unexpected end of file
tar: Child returned status 2
tar: Error is not recoverable: exiting now

I suspect that this is because it was created with the Windows Server 2003 Backup utility. I realize that I can leverage mtftar to get these contents, but how do I get the raw backup data first? Eg, I can't seem to list the file content on the drive initially here. Do I need to pipe initiate some kind of read via mt and then pipe that through mtftar in order to see the data structures on the backup tape?

Best Answer

mftar should according to the docs be able to read straight from the tape so ...

mftar < /dev/st0 | tar tvf -

If you'd rather grab the data off the tape first and then manipulate with mftar then you can use dd eg

dd if=/dev/st0 of=output1

You might need to specify block size with dd. If you don't know how the tape was written then tcopy can give you a report on its format.

If you've got multiple images on a single tape then you need to use the non-rewinding device /dev/nst0 along with explicit rewinds where required.