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.
[root@leda by-id]# mtx status
Storage Changer /dev/sg5:1 Drives, 24 Slots ( 1 Import/Export )
Data Transfer Element 0:Full (Storage Element 1 Loaded):VolumeTag = 000001L4
Storage Element 1:Empty
Storage Element 2:Full :VolumeTag=000002L4
Storage Element 3:Full :VolumeTag=000003L4
Storage Element 4:Full :VolumeTag=000004L4
Storage Element 5:Full :VolumeTag=000005L4
Storage Element 6:Full :VolumeTag=000006L4
Storage Element 7:Full :VolumeTag=000007L4
Storage Element 8:Full :VolumeTag=000008L4
Storage Element 9:Full :VolumeTag=000009L4
Storage Element 10:Full :VolumeTag=000010L4
Storage Element 11:Empty
Storage Element 12:Empty
Storage Element 13:Empty
Storage Element 14:Empty
Storage Element 15:Empty
Storage Element 16:Empty
Storage Element 17:Empty
Storage Element 18:Empty
Storage Element 19:Empty
Storage Element 20:Empty
Storage Element 21:Empty
Storage Element 22:Empty
Storage Element 23:Empty
Storage Element 24 IMPORT/EXPORT:Empty
[root@leda by-id]# mt -f /dev/st0 status
SCSI 2 tape drive:
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x46 (no translation).
Soft error count since last status=0
General status bits on (41010000):
BOT ONLINE IM_REP_EN
[root@leda by-id]# mt -f /dev/nst0 status
SCSI 2 tape drive:
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x46 (no translation).
Soft error count since last status=0
General status bits on (41010000):
BOT ONLINE IM_REP_EN
[root@leda by-id]# mt -f /dev/nst0 tell
/dev/nst0: Input/output error
[root@leda by-id]# mt -f /dev/st0 tell
/dev/st0: Input/output error
[root@leda by-id]# pwd
/dev/tape/by-id
[root@leda by-id]# ls
scsi-1IBM_3573-TL_00X2U78F8636_LL0 scsi-32001000e1111f393-nst
Tape 1 does contain some info as Amanda was able to use it.
I'd like to write my own script but it's not looking too well at the moment. I can't seem to be able to get a status of the tape loaded in drive0
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep:
I don't understand.
Your `mt -f /dev/nst0 status` worked. The tell operation may just not be available for that drive. You should be able to read/write/access the tape just fine. Play with it a bit and see what does work. Things like fsf, rewind, status, should all work.
Your `mt -f /dev/nst0 status` worked. The tell operation may just not be available for that drive. You should be able to read/write/access the tape just fine. Play with it a bit and see what does work. Things like fsf, rewind, status, should all work.
Code:
[root@leda by-id]# mt -f /dev/nst0 status
SCSI 2 tape drive:
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x46 (no translation).
Soft error count since last status=0
General status bits on (41010000):
BOT ONLINE IM_REP_EN
Tape Block Size = 0 bytes
Shouldn't it give me me the total amount of bytes on that tape?
I'd like to know how many bytes are written on that tape to fed my script if it should continue writing or tell me to load the next tape.
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep:
Nope. Typically mt does not give that kind of information. You have to track it independently. Look at `man mt`. What you get may depend in some part on your drivers, but, typically, you will be able to tell where you are positioned in terms of file numbers (starting at 0). Doing `mt -f /dev/nst0 eod` will take you to the end of data on the tape. `mt -f /dev/nst0 status` will then tell you where that is in terms of file number.
Either your backup software or your own script tracks how much stuff you have put on the tape. When you get an end of tape failure, that item has to be re-written on the next tape. If you write in segments that aren't too large, then you don't waste too much in that process.
You haven't mentioned the type of tape drive or library, by the way.
The linux `man mt` gives, in part:
Quote:
status
Print status information about the tape unit. (If the density code is "no translation" in the status output, this does not affect working of the tape drive.)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.