1753474 Members
4472 Online
108794 Solutions
New Discussion юеВ

Re: 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 12
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