When you have backup or recovery issues, the first step is to identify whether it is a software or hardware problem. For recovery problems, you can use od -c to read the beginning of a tape or archive file and make sure it is still in a readable format. This approach does not work if software compression is used. Table 9-4 describes the file record layout for tar.
The following is the tar file header (USTAR format): # od -c /dev/st0 |more 0000000 w o r k / \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 0000020 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 * 0000140 \0 \0 \0 \0 0 0 0 0 7 5 5 \0 0 0 0 0 0000160 0 0 0 \0 0 0 0 0 0 0 0 \0 0 0 0 0 0000200 0 0 0 0 0 0 0 \0 1 0 3 3 7 6 7 7 0000220 2 6 7 \0 0 1 0 5 6 0 \0 5 \0 \0 \0 0000240 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 * 0000400 \0 u s t a r \0 r o o t \0 \0 \0 0000420 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 0000440 \0 \0 \0 \0 \0 \0 \0 \0 \0 r o o t \0 \0 \0 0000460 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 * 0001000 w o r k / v m w a r e / \0 \0 \0 \0 0001020 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 * 0001140 \0 \0 \0 \0 0 0 0 0 7 5 5 \0 0 0 0 0 0001160 0 0 0 \0 0 0 0 0 0 0 0 \0 0 0 0 0 0001200 0 0 0 0 0 0 0 \0 1 0 3 4 0 1 1 6 0001220 0 2 5 \0 0 1 2 0 2 7 \0 5 \0 \0 \0 # dd if=/dev/st0 of=/tmp/foo.out bs=1k count=4; file /tmp/foo.out /tmp/foo.out: POSIX tar archive As you can see, the first field is the file or directory name, as you would expect. All the other fields including magic look intact. The same can be done with cpio, as shown in Table 9-5.
The ASCII cpio file header looks like this: # od -c /dev/st0 0000000 0 7 0 7 0 1 0 0 0 0 4 d b b 0 0 0000020 0 0 8 1 a 4 0 0 0 0 0 0 0 0 0 0 0000040 0 0 0 0 0 0 0 0 0 0 0 0 0 1 4 2 0000060 d d 6 2 4 e 0 0 0 0 0 0 3 0 0 0 0000100 0 0 0 0 f d 0 0 0 0 0 0 0 0 0 0 0000120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000140 0 0 0 0 1 1 0 0 0 0 0 0 0 0 / e 0000160 t c / r e s o l v . c o n f \0 \0 # dd if=/dev/st0 of=/tmp/foo.out bs=1k count=4; file /tmp/foo.out /tmp/foo.out: ASCII cpio archive (SVR4 with no CRC) That technique does not work as well with dump because the tape format is more complicated. You can still use dd to read the header and then run file against it, though.
Another common problem is when you can read a tape on your system but not on others. This problem is usually caused by misalignment of the tape heads on the drive. The tracks are readable and writable on your drive because they align. When the tape is taken to another system, the heads are not aligned with the tracks, so the tape is unreadable. An additional problem results when you have the tape drive fixed. This makes the tapes unreadable to your drive. Backup failures due to hardware issues are much easier to diagnose than software problems. If a tar to a device fails, you can try a cpio. If both fail, the problem is typically hardware. The one exception to this would be a problem with the device file. If a problem is diagnosed as hardware, I usually follow these steps:
If the backups still fail, it is most likely a bad drive. If you replace a tape drive, and it fails again after a short period of time, it can be maddening. What are the chances of two bad tape drives in a row? Oddly enough, it is most likely your tapes that have ruined the second drive. Tape drive failures are very commonly caused by damaged or fouled heads. These damaged drives can then damage or foul the tapes. If you replace the tape drive, and you still have dirty or damaged tapes, they can destroy the new tape drive. If you have a second drive failure in a row, then you should replace the drive and replace all the tapes. |