• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1200
  • Last Modified:

Linux SCSI tape dd issue

I'm working with FC6 and an LT01 SCSI tape drive.  I'm trying to create a copy of the tape and my plan was to use dd to read the tape to a file and then dd the file back to a blank tape.   The problem is that I'm only get 64k of data from the tape and then it stops like it's reached the end of the tape.  I created the tape a couple of hours ago on a Windows 2003 server (sp2) and it contains 104gb of data.  Oddly, I cannot find 'mt' on my system.

My dd command was as follows:    dd if=/dev/st0 of=/tmp/tapefile bs=128k.   Buffer sizes less than 64k generate memory errors and no data.
2 Solutions
Both dd, tar and any other command will run on a single track.
You first action is to install mt (package mt-st).
Your second action is to rewind the tape (I know it is being done by default when you insert it, and still)
Your third step is to dd the contents into a file.1
This is the first track. Your next dd will take the 2nd track, and so on.
Tape has "positions". You can forward or rewind the tape X amount of tracks (positions), seek the end to the tape (what is the last track), etc.

You need to dd each and every track separately, and dd it back into a blank tape. This, assuming your block size is similar, should do the trick.
the /dev/st0 ("auto-rewind device") device rewinds when it is closed

you need to usie the "no-rewind" device /dev/nst0 to read all the files on the tape

dd if=/dev/nst0 of=/tmp/tapefile1 bs=128k
dd if=/dev/nst0 of=/tmp/tapefile2 bs=128k
dd if=/dev/nst0 of=/tmp/tapefile3 bs=128k

until you encounter the end of tape marker (i.e. you get an error reading the next file / all you get are 0-byte files)

then swap tapes and write (again using the no-rewind device /dev/nst0)

dd of=/dev/nst0 if=/tmp/tapefile1 bs=128k
dd of=/dev/nst0 if=/tmp/tapefile2 bs=128k
dd of=/dev/nst0 if=/tmp/tapefile3 bs=128k

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now