Discussion:
Can't open tape device /dev/nst0
Vectorz Sigma
2008-08-05 19:04:39 UTC
Permalink
I have an Ultrium LTO-4, and cannot get it to work with Amanda.

[***@localhost ~]$ amlabel WeeklySet1 Weekly-01
Reading label...
Can't open tape device /dev/nst0: Bad file descriptor
amlabel: Could not open device tape:/dev/nst0.


Here is pertinent section of my /etc/amanda/WeeklySet1/amanda.conf:

runtapes 1 # number of tapes to be used in a single run
of amdump
#tpchanger "chg-disk" # the tape-changer glue script
#tapedev "file://data/amanda/vtapes/DailySet1/slots"
#tpchanger "chg-manual" # the tape-changer glue script
tapedev "tape:/dev/nst0" # the no-rewind tape device to be used

#changerfile "/etc/amanda/DailySet1/changer"
#changerfile "/etc/amanda/DailySet1/changer-status"
#changerfile "/etc/amanda/WeeklySet1/changer.conf"
#changerdev "/dev/null"

#tapetype HARDDISK
#tapetype HP-DAT # what kind of tape it is (see tapetypes
below)
tapetype LTO-4

define tapetype LTO-4 {
comment "ULTRIUM LTO-4, compression off"
length 770048 mbytes
filemark 0 kbytes
speed 73040 kps
}




*** Note that the tapetype was derived from doing the amtapetype command.

Thanks in advance for your help.
Marc Muehlfeld
2008-08-06 05:37:52 UTC
Permalink
Post by Vectorz Sigma
Reading label...
Can't open tape device /dev/nst0: Bad file descriptor
amlabel: Could not open device tape:/dev/nst0.
Allready tried if the drive is accessable by mt directly?

# mt -f /dev/nst0 status
--
Marc Muehlfeld (Leitung IT)
Zentrum fuer Humangenetik und Laboratoriumsmedizin Dr. Klein und Dr. Rost
Lochhamer Str. 29 - D-82152 Martinsried
Telefon: +49(0)89/895578-0 - Fax: +49(0)89/895578-78
http://www.medizinische-genetik.de
Vectorz Sigma
2008-08-06 15:06:42 UTC
Permalink
Marc -- Yes, I have tried to access it directly with tar, also mt commands
to rewind, etc. Also note that initially I setup Bacula on this system and
that worked so I know the drive is legit on that device name. I decided not
to use Bacula because the maintenance of the MySQL db got really out of hand
backing up a filesystem that had over 10million files on it, the db grew
7gb+ additionally for every full backup of this FS I had in the retention
period.

In any event, here is the mt status:

# 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

Dustin -- the output of the hardware I had provided initially was from the
'lshw' utility. I did notice this one error in /var/log/messages:

Aug 4 12:36:36 epassbackup2 kernel: st0: Sense Key : Illegal Request
[current]
Aug 4 12:36:36 epassbackup2 kernel: st0: Add. Sense: Invalid field in cdb
Dustin J. Mitchell
2008-08-06 06:08:44 UTC
Permalink
Post by Vectorz Sigma
I have an Ultrium LTO-4, and cannot get it to work with Amanda.
You had pasted some other diagnostic output that I didn't recognize to
#amanda. Can you give some more details? Also, please have a look in
your kernel logs to see if any HW errors have been detected.

Dustin
--
Storage Software Engineer
http://www.zmanda.com
Doyle Collings
2008-08-06 14:22:25 UTC
Permalink
My tapedev entry that works is tapedev "/dev/nst0" not tapedev "tape:/dev/nst0"

I have used the follow tape specific entries in my amanda.conf:

tapedev "/dev/nst0" # Linux @ tuck, important: norewinding

tapetype LTO4 # what kind of tape it is (see tapetypes below)
labelstr "^FULLBACK-[0-9][0-9]*$" # label constraint regex: all tapes must match

#diskdir "/var/tmp/amanda" # where the holding disk is
#disksize 10000 MB # how much space can we use on it
infofile "/var/lib/amanda/fullback/curinfo" # database filename
logfile "/var/log/amanda/fullback/log" # log filename

indexdir "/var/lib/amanda/fullback/index"

define tapetype LTO4 {
comment "LTO4 Library"
length 802816 mbytes
filemark 0 kbytes
speed 93057 kps

}
Vectorz Sigma
2008-08-06 15:00:31 UTC
Permalink
Doyle, thanks for the tip but I got errors when trying it without the
"tape:" in the string. I forgot to mention that I'm using 2.6.0p1

This is the error:

# amlabel WeeklySet1 Weekly-01
Reading label...
"/dev/nst0" uses deprecated device naming convention;
using "tape:/dev/nst0" instead.
Can't open tape device /dev/nst0: Bad file descriptor
amlabel: Could not open device /dev/nst0.
Post by Doyle Collings
My tapedev entry that works is tapedev "/dev/nst0" not tapedev "tape:/dev/nst0"
tapetype LTO4 # what kind of tape it is (see tapetypes below)
labelstr "^FULLBACK-[0-9][0-9]*$" # label constraint regex: all tapes must match
#diskdir "/var/tmp/amanda" # where the holding disk is
#disksize 10000 MB # how much space can we use on it
infofile "/var/lib/amanda/fullback/curinfo" # database filename
logfile "/var/log/amanda/fullback/log" # log filename
indexdir "/var/lib/amanda/fullback/index"
define tapetype LTO4 {
comment "LTO4 Library"
length 802816 mbytes
filemark 0 kbytes
speed 93057 kps
}
Dustin J. Mitchell
2008-08-06 15:31:09 UTC
Permalink
Post by Vectorz Sigma
Doyle, thanks for the tip but I got errors when trying it without the
"tape:" in the string. I forgot to mention that I'm using 2.6.0p1
The tape: thing is not the issue here -- the code that writes the
deprecation warning adds the prefix, and things go merriliy on. So
Post by Vectorz Sigma
Can't open tape device /dev/nst0: Bad file descriptor
amlabel: Could not open device /dev/nst0.
Which basically amounts to: "the kernel said there was an error." So
the next step is to ask the kernel -- check in dmesg, access the
device using dd or mt, and so on.

Dustin
--
Storage Software Engineer
http://www.zmanda.com
Dustin J. Mitchell
2008-08-06 21:50:43 UTC
Permalink
The mystery deepens.

Can you run 'amlabel' under strace or truss or your local equivalent?
I'd like to know what syscall is returning EBADFD (Bad file
descriptor). Also, please remind me what version of Amanda you're
running.

You can send the strace output to me privately for analysis if you'd
like, rather than spamming the list (it will be *large*)

Dustin
Vectorz Sigma
2008-08-06 23:32:37 UTC
Permalink
I downgraded to Amanda 2.5.2p1 and it gave me a better clue when running
amlabel. Basically it said /dev/nst0 = permission denied. I've been
running the amlabel command as amandabackup but didn't realize you need to
give permissions to the /dev/nst0 device (which was 750 perms and owned by
root:root). I chmod'd to 777 to test and that fixed the problem.

Is it a known deal that we're supposed to change permission on the tape dev
name?
Post by Dustin J. Mitchell
The mystery deepens.
Can you run 'amlabel' under strace or truss or your local equivalent?
I'd like to know what syscall is returning EBADFD (Bad file
descriptor). Also, please remind me what version of Amanda you're
running.
You can send the strace output to me privately for analysis if you'd
like, rather than spamming the list (it will be *large*)
Dustin
Dustin J. Mitchell
2008-08-06 23:49:40 UTC
Permalink
Post by Vectorz Sigma
I downgraded to Amanda 2.5.2p1 and it gave me a better clue when running
amlabel. Basically it said /dev/nst0 = permission denied. I've been
running the amlabel command as amandabackup but didn't realize you need to
give permissions to the /dev/nst0 device (which was 750 perms and owned by
root:root). I chmod'd to 777 to test and that fixed the problem.
Is it a known deal that we're supposed to change permission on the tape dev
name?
The device should have the group 'disk' (or equivalent), and
amandabackup should be in that group.

However, it's definitely a bug to not report that as "permission
denied", so I'll take a look. Thanks for chasing this down.

Dustin
--
Storage Software Engineer
http://www.zmanda.com
Vectorz Sigma
2008-08-06 21:19:28 UTC
Permalink
TIA for your help thus far. Following your advice, here is a diag tool I
ran on my HP Ultrium LTO-4 that indicates all is working well on it and
verifies it is /dev/nst0. I have checked my logs and the last error I've
seen was a few days ago, nothing produced by the diags done recently.

Main > Drive Information > Device Performance Tool > Viewer >
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Device Performance Test Started on Drive (Ultrium 4-SCSI)
(0.0.0[0-/dev/sg0])
- Opening Tape Drive 0.0.0[0-/dev/sg0]
- Successfully opened the Tape Drive /dev/nst0
- 2147 MB written in 28.6348 seconds at 74.9955 MB/s
Doyle Collings
2008-08-06 14:48:52 UTC
Permalink
I would also verify that nst0 is assigned to your LTO 4 drive
What brand of Ultrium LTO 4 do you use. Mine is a Tandberg Data or Exabyte. I use the ltoTool to check and see if the device is being recognized. If your Ultrium LTO 4 is not an Tandberg, I am sure the manufacturer has a tool to verify the device. My ltoTool command and output is:

fs2:/ # /downloads/tandbergtools/Linux/ltoTool -i /dev/nst0
Tandberg ltoTool -- V4.90t
Copyright (c) 2006-2007, Tandberg Data ASA.
Copyright (c) 1996-2006, Exabyte Corp.

*** BETA *** BETA *** BETA *** Test version! Use at own risk.
This beta version built by RTist BV - The Netherlands on Oct 11 2007, 23:22:05

Tape Drive identified as LTO4(IBM)
/dev/nst0 - Vendor : IBM
/dev/nst0 - Product ID: ULTRIUM-TD4
/dev/nst0 - Firmware : 74H6
/dev/nst0 - Serialnum : 1310082873
/dev/nst0 - This tape : 5 times loaded into a drive

Done
Loading...