Re: Odd error from amcheck

Jon LaBadie <[email protected]> Wed, 17 Apr 2019 23:10:06 -0400
Newsgroups gmane.comp.archivers.amanda.devel
Message-ID <[email protected]>
On Wed, Apr 17, 2019 at 11:00:11PM +0000, Debra S Baddorf wrote:
> 
> > On Apr 17, 2019, at 5:40 PM, Jon LaBadie <[email protected]> wrote:
> > 
> > On Wed, Apr 17, 2019 at 06:24:42PM +0000, Debra S Baddorf wrote:
> >> 
> >>> On Apr 17, 2019, at 12:15 PM, Jason L Tibbitts III <[email protected]> wrote:
> >>> 
> >>> Has anyone seen anything like this?  What's the magic incarnation to
> >>> read the amanda label from a tape without running amanda tools?  (I know
> >>> dd should do it but I can't seem to find the right combination of
> >>> options.)
> >>> 
> >>> - J<
> >> 
> >> 
> >> mt -f /dev/nst0   rewind
> >> dd if=/dev/nst0   of=MyFile   bs=512k   
> >> mt -f /dev/nst0   rewind     !! so ready for amanda to use it
> >> 
> >> for   /dev/nst0   substitute the location of your drive   (grep amanda.conf  to find it)
> >> 
> >> for bs=512k   you may have to guess higher or lower (if an older, smaller tape).
> >> This is usually the hardest part to guess at.
> >> 
> >> 
> >> Then do     more MyFile
> >> read the first block   and ^Q   out of the rest.   
> >> 
> >> Mine shows    
> >> AMANDA: TAPESTART DATE 20190204200001 TAPE ad5-daily-123
> >> ^L
> >> 
> > 
> > Isn't the amanda tape header data still 32KB?  I thought you
> > could skip syncronizing dd block size and actual tape bs.
> > 
> > For example:
> > 
> >  # dd if=/dev/???? of=MyFile bs=32k count=1
> > 
> > Skip the "of=MyFile" to write to stdout/screen.
> > 
> > I think you would have to synchronize the bs of dd and the
> > tape if you wanted to read file data from the tape.  But
> > not the 1st 32KB.
> > 
> 
> Can it do mixed block sizes on the same tape?   Cuz I know the rest of my blocks are 512k,
> possibly by my choice.   For LTO5 tapes.    (I had read that larger tapes need a larger block size.)
> Oh here it is:   
> grep  BLOCK_SIZE   amanda.conf
>       device-property "BLOCK_SIZE"  "512k"   # from man amanda-changers.7
> to see what block size you are using.   If you don’t find the term,  then perhaps it’s a default 32k
> The “from man amanda-changers.7”  was a note to myself.
> 
> 
> When I omit  the blocksize,  I get  “Cannot allocate memory”:
>      dd: reading `/dev/nst0': Cannot allocate memory
> which isn’t an obvious error, but always goes away when I find the right blocksize to specify.
> 
> It fails to read ANY blocks, until I get the right blocksize.    I’m only looking
> at the tape-label   first file.   I think the tape-label uses the block size you’ve specified, for the whole tape.
> 
> dd if=/dev/nst0  bs=512k    works fine  (straight to standard out)
> dd if=/dev/nst0                    fails, and gets the above error.   For me.
> 

Sorry Deb, you and Jason have demonstrated my lack of experience
with large tapes.

I did assume the tape header was written in the same size block
as the rest of the tape, 512KB in this case.  But I expected
that "dd" could read a partial block.

I now have a dim memory that dd must have a block size at least
as big as the device it is reading from.  Otherwise dd's input
buffer overflows.

I was disappointed to see that dd's "count" option is based on
input blocks.  But I found a flag that lets me output only 32K
with a large block size.  At least with regular files as input.
I don't have large tapes to test.

  dd bs=2M if=<your_device> iflag=count_bytes count=32K

I stuck a 2M block size in there thinking it would be a nice
multiple of any real block size.

The iflag=count_bytes is the flag that converts count=###
into bytes rather than blocks.

Sorry again for the fuzz with my earlier post.

Jon
-- 
Jon H. LaBadie                 [email protected]
 11226 South Shore Rd.          (703) 787-0688 (H)
 Reston, VA  20190              (703) 935-6720 (C)