Path: utzoo!attcan!uunet!know!cs.utexas.edu!yale!cmcl2!adm!news From: 0004068145@mcimail.com (Ari Kahan) Newsgroups: comp.unix.questions Subject: Trashed Tar tape Message-ID: <24568@adm.BRL.MIL> Date: 20 Sep 90 20:08:01 GMT Sender: news@adm.BRL.MIL Lines: 47 In re: >Can someone help? A full tape was made unreadable. The error probably >was someone typing 'tar cv ' instead of 'tar xv '. >Since the file was not on the harddrive at that point, a 'file does >not exist' came up and the data on the tape is now inaccesible. Since >the tape has not been advanced, it stands to reason that the data is >still on it, but unix has placed some sort of maer at the beginning of the t >I have tried the mt comands to forward over EOF markers, but no luck. >If anyone can help, please contact me directly, since I am not a >regular subscriber to this list. Vikram_varma@cc.sfu.ca >Thanks. Vik. Here's a solution which, in theory, should allow you to get back everything except the first file on the tar tape. Since I don't know what flavor of UNIX you're using, it's hard to know for sure whether it'll work on yours. As you suspected, the only part of the tape that should be lost is the very beginning. Since each file on the tartape has its own header, the idea is to skip over the first file and its header to the second file. So, the concept is to run the contents of the tape through stdin to tar, but hide the first (mangled) portion of the contents of the tape from tar. Tar (unless it's some weird version) stores files in 512 byte blocks. So, the first file (with its header) will be sized at a multiple of 512, regardless of the actual size of the file. To eliminate the mangled first file, you can use dd to skip the first block on the tape, or the first two blocks, or the first three blocks, until you get something that makes sense. The command should look something like this: dd if=/dev/fd1 skip=1 ibs=512 | tar tv ^(or however you identify your tape drive) Try this, changing the value of the skip to skip=2, skip=3, etc. (you may want to use a batchfile) until you get something looking like normal output from tar. (Obviously, this process will go a lot faster if you have some idea of the size of the first file on the tape.) Once you know how many blocks to skip, you can use tar as normal. You just won't get that first file. Ari Kahan