cancel
Showing results for 
Search instead for 
Did you mean: 

Tape device path

 
heaman1
Regular Advisor

Tape device path

I have a tape drive that attached to the Redhat server , I use dmesg show the below messages

#dmesg |grep tape
Attached scsi tape st0 at scsi1, channel 0, id 5, lun 0
st0: Write not multiple of tape block size.

I assume the drive is attached to the device path /dev/st0 of my server , then I tried tar -cvf /dev/st0 /tmp , but I found that the file is backup to the file /dev/st0 but not the tape drive , can advise how can I know what device path that attached ? thx
12 REPLIES
Goran Koruga
Honored Contributor

Re: Tape device path

Hello.

You should verify if the axtual device file is created - perhaps it creates it elsewhere.

You should also see it in /sys tree. As a last resort you can find it using device numbers in /dev.

Goran
John McNulty_2
Frequent Advisor

Re: Tape device path


I like to use lshw. Not all Linux distributions install it by default unfortunately, but you can find an rpm or the source for it easily enough on google.

In this case I would do:

[root@sdltrng01 ~]# lshw -class tape
*-tape
description: SCSI Tape
product: DLT7000
vendor: QUANTUM
physical id: 0.6.0
bus info: scsi@0:0.6.0
logical name: /dev/nst0
logical name: /dev/st0
version: 296D
serial: CX905S6032
capabilities: removable
configuration: ansiversion=2

Which gives me the appropriate take device names for the norewind device (nst0) and the rewind device (st0). Yours may be different.

If you have a tape loaded you can test the device is online and the tape is visible with the command:

[root@sdltrng01 ~]# mt -f /dev/nst0 status
SCSI 2 tape drive:
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x1b (DLT 35GB).
Soft error count since last status=0
General status bits on (41010000):
BOT ONLINE IM_REP_EN


The mt command on Redhat comes with the mt-st RPM package.

John

heaman1
Regular Advisor

Re: Tape device path

thx replies ,

with your method , I checked that the device path is /dev/nst0 , I can eject the tape from this device so I sure the device path is correct .

#mt -f /dev/nst0 status
SCSI 2 tape drive:
File number=-1, block number=-1, partition=0.
Tape block size 0 bytes. Density code 0x0 (default).
Soft error count since last status=0
General status bits on (50000):
DR_OPEN IM_REP_EN

But however , when I tried to tar files to it , it didn't allow to do it , can advise what is wrong ? thx

#tar -cvf /dev/nst0 /tmp
tmp/test
tar: /dev/nst0: Wrote only 0 of 10240 bytes
tar: Error is not recoverable: exiting now

heaman1
Regular Advisor

Re: Tape device path

I have another question , in case , what is the "non-rewinding tape device" in my server ? thx for help
Goran Koruga
Honored Contributor

Re: Tape device path

The difference in "nst" vs "st" device is that for the former no automatic rewind is performed.
heaman1
Regular Advisor

Re: Tape device path

thx reply,

I can eject the tape by mt -f /dev/st0 offline , the device path must correct , but when tar file to it "tar -zcvf /dev/st0 file" , I found there is a file /dev/st0 created , it seems not write to the tape , can advise what is wrong ? thx
John McNulty_2
Frequent Advisor

Re: Tape device path

Sounds like somehow the character device /dev/st0 has been removed and tar has just created a new regular tar archive file with the same name. On a system here the files should look like this:

# ls -l /dev/*st0
crw-rw---- 1 root disk 9, 128 May 19 10:39 /dev/nst0
crw-rw---- 1 root disk 9, 0 May 19 10:39 /dev/st0

If they don't begin with "c" then this is potentially your problem. Are you able to reboot this system? If so then remove these device files and reboot and the devices should be recreated for you.


heaman1
Regular Advisor

Re: Tape device path

thx replies,

I will reboot it later for creating /dev/st0 .

But I am wonder in my system , there is /nst0 , is it also the tape drive path ? if yes , why I am unable to write files to the tape ?
#ll /dev/nst0
crw-rw---- 1 root disk 9, 128 Jun 25 2004/dev/nst0



#tar -cvf /dev/nst0 /tmp/*
/tmp/file.txt
tar (child): /dev/nst0: Wrote only 0 of 10240 bytes
tar (child): Error is not recoverable: exiting now
Broken pipe

Goran Koruga
Honored Contributor

Re: Tape device path

Check if kernel says anything when this happens.

Goran
John McNulty_2
Frequent Advisor

Re: Tape device path


Hm, yes something is still not right as it should work ok with the nst0 device you have now.

What strikes me as odd is the result of the of your mt status. Are you sure you have a tape in there and the tape is good? The status code you're seeing DR_OPEN = "Door is Open", which depending on the tape drive you have usually means there is no tape present.

The status codes I see on an mt status on a system here are BOT ONLINE IM_REP_EN where:

BOT = Beginning of Tape
ONLINE = The drive has a tape in place and ready for operation.

Have you checked your tape drive to make sure there are no warning lights/indicators? Maybe you have a hardware fault. If that's ok then try changing the tape for another one.
heaman1
Regular Advisor

Re: Tape device path

thx replies,

I have just reboot the server , but still can't find /dev/st0 in my server ,

I 100% sure the drive is properly work, as I everyday backup it by ARCserver .

thx
GMcCX
Occasional Visitor

Re: Tape device path


How about this:

tar -cvf /dev/st0 / > /var/log/backup.log

(point the log file redirect where ever you want of course, or not)

This works fine on an older RH 7 box.