How Can I Tell Whether My Tape Problem Is Hardware or Software?


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.

Table 9-4. File Record Layout for tar

Field Size

Field Descriptor

Detail

100

name

Name of file

8

mode

File mode

8

uid

Owner user ID

8

gid

Owner group ID

12

size

Length of file in bytes

12

mtime

Modify time of file

8

chksum

Checksum for header

1

typeflag

Type of file

100

linkname

Name of linked file

6

magic

USTAR indicator

2

version

USTAR version

32

uname

Owner user name

32

gname

Owner group name

8

devmajor

Device major number

8

devminor

Device minor number

155

prefix

Prefix for filename


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.

Table 9-5. File Record Layout for cpio

Field Size

Field Descriptor

Detail

6

magic

Magic number "070707"

6

dev

Device where file resides

6

ino

I-number of file

6

mode

File mode

6

uid

Owner user ID

6

gid

Owner group ID

6

nlink

Number of links to file

6

rdev

Device major/minor for special file

11

mtime

Modify time of file

6

Namesize

Length of filename

11

filesize

Length of file to follow


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.

[View full width]

# dd if=/dev/st0 of=/tmp/foo.out bs=1k count=4; file /tmp/foo4.out /tmp/foo4.out: new-fs dump file (little endian), This dump Sat Nov 19 14:37:02 2005, Previous dump Wed Dec 31 19:00:00 1969, Volume 1, Level zero, type: tape header, Label none, Filesystem /work, Device /dev/mapper/vg00-test, Host linux, Flags 3



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:

1.

Try multiple tapes.

2.

Run the cleaning tape through five times.

3.

Try a new tape.

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.



Linux Troubleshooting for System Administrators and Power Users
Real World Mac Maintenance and Backups
ISBN: 131855158
EAN: 2147483647
Year: 2004
Pages: 129
Authors: Joe Kissell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net