Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Aug 2011 14:50:23 -0400
From:      Renee Gehlbach <fbsd-ml@gehlbach.com>
To:        questions@freebsd.org
Subject:   Re: Problem reading from tape drive
Message-ID:  <4E57EAEF.1020300@gehlbach.com>
In-Reply-To: <201108252238.p7PMcwxQ020019@mail.r-bonomi.com>
References:  <201108252238.p7PMcwxQ020019@mail.r-bonomi.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On 08/25/2011 06:38 PM, Robert Bonomi wrote:
>>  From owner-freebsd-questions@freebsd.org  Thu Aug 25 13:57:20 2011
>> Date: Thu, 25 Aug 2011 14:24:57 -0400
>> From: Renee Gehlbach<fbsd-ml@gehlbach.com>
>> To: questions@freebsd.org
>> Cc:
>> Subject: Problem reading from tape drive
>>
>> I recently purchased a FreeBSD-compatible SAS card (an Adaptec ASR
>> 2045)  and moved our backup server from Ubuntu to FreeBSD 8.2.  I am
>> trying to set up the backup software, but am having problems with the
>> tape drive.  Hopefully this is a "duh" type question, since I have a lot
>> more experience working with tape drives in Ubuntu than FreeBSD.
>>
>> I installed bacula, and ran the test function in the btape utility.  It
>> wrote 10000 blocks, wrote EOF, wrote 10000 blocks, wrote EOF, wrote
>> EOF.  Rewound the tape.  Read 10000 blocks, failed reading the second
>> 10000 blocks.  I had no luck researching the bacula error message, so I
>> switched to mt and tar for further troubleshooting.
>>
>> camcontrol devlist does show the tape drive:
>> backup# camcontrol devlist
>> <QUANTUM ULTRIUM 3 2182>            at scbus2 target 0 lun 0 (sa0,pass0)
>>
>>
>> So then I went into a directory that had one subdirectory, which
>> contained several plain text logfiles.  I did four tars, alternating
>> between that directory and the subdirectory (so I would be able to see a
>> difference between the tar files).
>>
>> backup# mt -f /dev/nsa0 rewind
>> backup# tar -cf /dev/nsa0 *
>> backup# cd log/
>> backup# tar -cf /dev/nsa0 *
>> backup# cd ..
>> backup# tar -cf /dev/nsa0 *
>> backup# cd log/
>> backup# tar -cf /dev/nsa0 *
>>
>>
>> So far so good.  Then I went back to read those tar files.
>>
>> backup# mt -f /dev/nsa0 rewind
>> backup# tar -tf /dev/nsa0
>> log/
>> log/mbw01.log
>> (....insert rest of correct tar listing)
>> backup# tar -tf /dev/nsa0
>> tar: Unrecognized archive format
>> tar: Error exit delayed from previous errors.
>>
>>
>> So....same results as bacula's tape test utility was giving.....it
>> writes, it reads the first file, then errors on trying to read the
>> second file.  However:
>>
>>
>> backup# mt -f /dev/nsa0 rewind
>> backup# tar -tf /dev/nsa0
>> log/
>> log/mbw01.log
>> (....insert rest of correct tar listing)
>> backup# mt -f /dev/nsa0 fsf
>> backup# tar -tf /dev/nsa0
>> mbw01.log
>> (....insert rest of correct tar listing)
>> backup# mt -f /dev/nsa0 fsf
>> backup# tar -tf /dev/nsa0
>> log/
>> log/mbw01.log
>> (....insert rest of correct tar listing)
>> backup# mt -f /dev/nsa0 fsf
>> backup# tar -tf /dev/nsa0
>> mbw01.log
>> (....insert rest of correct tar listing)
>> backup# mt -f /dev/nsa0 fsf
>>
>>
>> So, when I tell it to forward space file at the end of each tar file, it
>> is able to read all four files correctly.  This leaves me scratching my
>> head, and wondering what the heck I've set up wrong.  Any ideas?
> Tape drivers _always_ write two EOFs when the tape device is closed.
> This ensures there is always a valid 'EOT' on the tape.
>
> They're _suppoesed_ to backspace over the 2nd EOF mark, so that
> a subsequent write has only one EOF between it and the prior file.
>
> Looks like your drive isn't doing the 'backspace' right.
>
> I suspect the 'easiest' work around is the one you've discovered  -- do
> an 'mt -fsf' after avery tape file 'read'.
>
>
>
OK, I feel pretty dense....  When you're saying they write two EOFs when 
the device is closed, would this happen every time you write a file?  Or 
would it be every time the tape is unmounted?  Or would that depend on 
the program you're using?

Is there any way I could test to make sure this is in fact what's happening?

And would the problem with it not doing the backspace right be an issue 
with the FreeBSD tape driver?  Or SCSI card driver?  Or what driver?  
Obviously not a problem with the drive itself, since I don't have this 
problem with Ubuntu.  Unfortunately, the "workaround" of running mt -fsf 
after every file read isn't really usable workaround.....I need the tape 
drive to work with bacula, not just running tars.  Where do I go from here?

Thanks,
Renee



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?4E57EAEF.1020300>