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):  

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?

  • A tape is simply a sequence of byte strings. Put the tape into the drive, and issue 'cat /dev/nst0' and this will print the first file. That is all, it is that simple. Of course you do not want to print print binary data, but I hope you understand the concept. You can pipe the result to a program, or redirect it to a file. mt can be used to jump directly to the - for example - fifth byte strings. The 'mt' command is like the forward, backward, eject buttons on a CD player (but not the play button). – Hontvári Levente Apr 21 '15 at 9:09

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.

| improve this answer | |
  • Indeed I'm hitting some walls here and I suspect it is regarding block size perhaps. mtftar < /dev/st0 | tar -tvf - fails with tar: This does not look like a tar archive and dd if=/dev/st0 of=tape_contents fails dd: error reading ‘/dev/st0’: Cannot allocate memory. tcopy is not floating around on ubuntu here it seems so I'm kind of wondering how to ascertain additional data necessary to pursue this. – ylluminate Apr 21 '15 at 14:51
  • It's a while since I needed to deal with tapes that I didn't write (if you wrote them, you generally know block size and format). My inclination would be to get hold of source for tcopy and try compiling but serverfault.com/questions/366571/restore-old-sunos-tapes has detailed instructions for how to do this using just dd and trial and error. – Paul Haldane Apr 21 '15 at 20:09
  • Right, unfortunately this is for tapes that I did not create and since it was created by Windows 2003 Backup application, there are a number of variables I may not be able to find out... – ylluminate Apr 21 '15 at 22:24
  • geek.com/news/windows-2003-server-has-backup-flaw-553548 suggests that NTBackup on Windows Server 2003 used 64KB block size so dd if=/dev/st0 ibs=64K would be worth a try to get the data off the tape. You can then try using mftar on the resulting file. – Paul Haldane Apr 21 '15 at 22:40

I just came across the same error message and posted a detailed explanation in this question.

In short, Cannot allocate memory means the program you are using to read the tape isn't using a large enough buffer to read data off the tape. If the program you are using cannot have the size of the read buffer set, you can use dd for this:

dd if=/dev/nst0 bs=1M | tar tvf -

This will use 1MB read buffers which will be able to read tape blocks of 1MB or less in size. Increase as needed until Cannot allocate memory goes away - the value needs to be the same as or larger than the largest block on the tape.

The size of the tape blocks is set during the writing process by the application doing the writing.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.