LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 06-15-2009, 04:50 AM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 31
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
 
Old 06-15-2009, 07:09 AM   #2
yai
LQ Newbie
 
Registered: Jun 2008
Posts: 19

Rep: Reputation: 1
hwinfo --tape
will show you the device file, e.g. /dev/tape or /dev/st0, and the driver the system tries to use. then
mt -f <devic file> status
will show you the state of your tape device.
 
Old 06-15-2009, 07:38 AM   #3
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
If it wrote to a file it suggests that the "device" files were not created for your drive.

If you do something like "ls -l /dev/st0*" you ought to see something like:
crw-rw---- 1 root disk 9, 0 Apr 12 22:12 /dev/st0
crw-rw---- 1 root disk 9, 96 Apr 12 22:12 /dev/st0a
crw-rw---- 1 root disk 9, 32 Apr 12 22:12 /dev/st0l
crw-rw---- 1 root disk 9, 64 Apr 12 22:12 /dev/st0m

The c in first position tells you that you have a character (a/k/a raw) device file. If there is no c (or b, l, or d) then it is is a "regular" file. You should delete that regular file then run:

Code:
MAKEDEV st0
That should make the device files for you.
 
Old 06-16-2009, 05:03 AM   #4
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
thx reply,

I can eject the tape by mt -f /dev/st0 offline , the device path /dev/st0 must is my tape device , 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
 
Old 06-16-2009, 02:09 PM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
It doesn't make sense that mt would find the device file by name but your tar wouldn't.

Type "ls -l /dev/st0*" and post results here please.
 
Old 06-17-2009, 12:59 AM   #6
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by jlightner View Post
It doesn't make sense that mt would find the device file by name but your tar wouldn't.

Type "ls -l /dev/st0*" and post results here please.
crw-rw---- 1 root disk 9, 0 Jun 24 2004 /dev/st0
crw-rw---- 1 root disk 9, 96 Jun 24 2004 /dev/st0a
crw-rw---- 1 root disk 9, 32 Jun 24 2004 /dev/st0l
crw-rw---- 1 root disk 9, 64 Jun 24 2004 /dev/st0m
 
Old 06-17-2009, 02:16 AM   #7
yai
LQ Newbie
 
Registered: Jun 2008
Posts: 19

Rep: Reputation: 1
please write to the tape "tar -cf /dev/st0 <some_files>" then "ls -l /dev/st0*" then "tar -tf /dev/st0" and post all the output.
 
Old 06-17-2009, 07:42 AM   #8
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You have: crw-rw---- 1 root disk 9, 0 Jun 24 2004 /dev/st0

That is the character device file you should have so I don't understand why you think it is "creating a file" rather than writing to tape. That character device file IS the tape drive not a regular file.
 
Old 06-19-2009, 03:23 AM   #9
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by jlightner View Post
It doesn't make sense that mt would find the device file by name but your tar wouldn't.

Type "ls -l /dev/st0*" and post results here please.
thx replies,

I still can't find it

dev]# ls -l /dev/st0
ls: /dev/st0: No such file or directory
 
Old 06-19-2009, 03:24 AM   #10
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by yai View Post
please write to the tape "tar -cf /dev/st0 <some_files>" then "ls -l /dev/st0*" then "tar -tf /dev/st0" and post all the output.
After tar -cf /dev/st0 <some_files> , /dev/st0 is a file , the file not begins with c ,


Thx
 
Old 06-19-2009, 03:36 AM   #11
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
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
 
Old 06-19-2009, 08:54 AM   #12
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
/dev/nst0 should point to same drive as /dev/st0. The difference being that the /dev/st0 will automatically rewind tape after the backup and the /dev/nst0 won't. (The n = "no rewind".) The reason for using a no rewind device is to allow you to add another backup after the one already on the tape.

I just noticed something though - In an earlier post you put as output for "ls -l /dev/st0*" the following:

Quote:
ls -l /dev/st0*
crw-rw---- 1 root disk 9, 0 Jun 24 2004 /dev/st0
crw-rw---- 1 root disk 9, 96 Jun 24 2004 /dev/st0a
crw-rw---- 1 root disk 9, 32 Jun 24 2004 /dev/st0l
crw-rw---- 1 root disk 9, 64 Jun 24 2004 /dev/st0m
However you just posted:
Quote:
dev]# ls -l /dev/st0
ls: /dev/st0: No such file or directory
In the earlier post you see /dev/st0 but in later one you don't. This could occur if in fact the file that appears to be /dev/st0 in earlier post has hidden characters after the name. Sometimes you could see this by trying to type "ls -l /dev/st0* |cat -v".

Alternatively you could simply do "rm /dev/st0*" then do the MAKEDEV I suggested in an earlier post. You do not need to reboot to make the devices as that is what MAKEDEV does.

Last edited by MensaWater; 06-19-2009 at 10:52 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tape device ust Linux - Newbie 3 03-16-2009 05:43 AM
Tape device, id mt eof necessary aimed Linux - Server 4 12-24-2008 06:51 AM
How to find the tape device sunhui Linux - Software 2 12-08-2006 11:44 AM
tape device ust Linux - Software 3 09-10-2005 11:50 AM
different tape device ust Linux - General 0 10-25-2004 09:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration