Amanda-Users

Re: to compress or not to compress ???

2003-07-03 21:50:57
Subject: Re: to compress or not to compress ???
From: Gene Heskett <gene.heskett AT verizon DOT net>
To: "Michael D. Schleif" <mds AT helices DOT org>, amanda mailing list <amanda-users AT amanda DOT org>
Date: Thu, 3 Jul 2003 21:46:55 -0400
On Thursday 03 July 2003 15:10, Michael D. Schleif wrote:
>Also sprach Gene Heskett (Thu 03 Jul 02003 at 02:51:39PM -0400):
>> On Thursday 03 July 2003 11:42, Michael D. Schleif wrote:
>> >Yes, I am learning -- at the expense of many questions ;>
>> >
>> >First, a brief overview:
>> >
>> >I have five (5) Linux servers, totaling ~50 Gb used diskspace,
>> > divided roughly even across all five.
>> >
>> >I have several DAT tape drives, the largest of which is an HP
>> > DDS-3. I have twelve (12) DDS-3 tapes, and twenty (20) DDS-2
>> > tapes, as well as several cleaning tapes.
>> >
>> >So far, I have configured:
>> >
>> >    dumpcycle     7
>> >    runspercycle  7
>> >    runtapes      1
>>
>> You left out tapecycle, which is the number of tapes in the
>> rotation pool, in this case it should be not less than 15.
>
>Wouldn't that be eight (8)?
No, not if you don't want to be overwriting the only full you have with one 
that might just fail, leaving you with no full to anchor the recovery to.
>
>       runspercycle * runtapes + 1
>
Most of us consider that to be 2*runspercycle*runtapes+1

><snip />
>
>> One thing to be aware of is that a tape, once written in the
>> compressed mode, remembers that, and will overwrite your choices
>> unless you go to a rather detailed method of removing the
>> compressed flags.
>
>How do I do this?
>
>These tape drives have all used compression, and many of these tapes
>have been used once or twice.  So, it looks like I will *not* use
>hardware compression, and I want to reap all of the benefits of that
>strategy.
>
Clip this script and adjust to suit.
--------------------------
#!/bin/sh
if [ `whoami` != 'root' ]; then
        echo
        echo "!!!!!!!!!!!!!!!!! Warning !!!!!!!!!!!!!!!!!!"
        echo "fixcomp needs to be run by the user root,"
        echo "else the perms on some commands will be denied."
        echo
        exit 1
fi

# blatently stolen from the bash manual
NUMBERS="0 1 2 3" # Increase or decrease to match the number of slots
# in your magazine, mine holds 4 DDS2 tapes
for number in $NUMBERS
do
        echo "amtape DailySet1 slot "$number
        su amanda -c 'amtape DailySet1 slot '$number
        mt -f /dev/nst0 rewind
        dd if=/dev/st0 of=./scratch bs=64K count=1
        ls -l ./scratch # see how big the label is
        mt -f /dev/nst0 compression off
        mt -f /dev/nst0 defcompression -1
        # write it back, with fixed 32k block in case the read
        # above was short
        dd if=./scratch of=/dev/nst0 bs=32K conv=sync
        mt -f /dev/nst0 tell
        # This seems to get rid of compressed headers
        echo "forcing buffer flush with an 4+ meg write to tape # "$number
        dd if=/dev/zero bs=32K count=130 of=/dev/st0
        echo "Now reading the label"
        # display it on the console to verify its undamaged
        dd if=/dev/st0 bs=32K
        mt -f /dev/st0 status
done
exit 0
----------------------------
This is probably not the only way to do it, but it seems to 
work here just fine.  This does however, assume that you 
have located the jumper or dipswitch that sets the drives default
compression status and set it to the off position.

>Also, what is the best way to turn off compression?
>
>    # sudo mt-gnu -f /dev/nst0 datcompression
>    Compression on.
>    Compression capable.
>    Decompression capable.
>
>    # sudo mt-gnu -f /dev/nst0 datcompression 0
>    Compression off.
>    Compression capable.
>    Decompression capable.
>
>    # sudo mt-gnu -f /dev/nst0 datcompression
>    Compression off.
>    Compression capable.
>    Decompression capable.
>
>Will this persist across power cycles?

No, on powerup the drive will revert to the dipswitch settings.

>  Will previously hardware
>compressed tapes turn hardware compression back on?

Yes, as soon as the drive recognizes the tape.  The above 
script should fix that.  In my tests here, if the extra 
4 meg write isn't done, then the tape will be uncompressed, 
but the header still will be.  The extra write to force the
buffer flush seems to fix that.

-- 
Cheers, Gene
AMD K6-III@500mhz 320M
Athlon1600XP@1400mhz  512M
99.26% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attornies please note, additions to this message
by Gene Heskett are:
Copyright 2003 by Maurice Eugene Heskett, all rights reserved.