Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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:
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
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
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.
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
/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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.