[Eisfair] Paket hdtune modifizieren

Thomas Bork tom at eisfair.org
Di Mai 26 22:11:30 CEST 2015


Am 25.05.2015 um 12:17 schrieb Uwe Kunze:

>> Use of -m is VERY DANGEROUS.
>> Only the old IDE drivers work correctly with -m with kernels up to at
>> least 2.6.29.
>> libata drives may fail and get hung if you set this flag.
>> Please supply the --yes-i-know-what-i-am-doing flag if you really want
>> this.
>> Program aborted.
>> /dev/sda:
>>  setting fs readahead to 4
>>  setting 32-bit IO_support flag to 0
>>  setting multcount to 16
>> *** ERROR: Disk sda does not support your HDTUNE-Settings. ***
>> hdtune:
>> hdtune: /dev/sda:
>> hdtune:  setting fs readahead to 4
>> hdtune:  setting 32-bit IO_support flag to 0
>> hdtune:  setting multcount to 16
>> Press ENTER to continue
> Da müsste dann wahrscheinlich das init-Script dahingehend geändert werden.

Wie wär's damit?

#! /bin/sh
#------------------------------------------------------------------------------
# /etc/rc.d/rc.hdtune - change modes for ide-harddisks
#
# Creation:    2001-07-31 tb
# Last Update: 2015-05-26 tb
#------------------------------------------------------------------------------

# . ../config.d/hdtune
. /etc/config.d/hdtune
. /var/install/include/eislib

tmp="/tmp/hdtune"

if [ "$HDTUNE_DO_DEBUG" = yes ]
then
     set -x
fi

#if [ "$START_HDTUNE" = "yes" ]
#then
     mecho -info "setting hdd modes now..."

     idx=1
     while [ "$idx" -le "$HDTUNE_N" ]
     do
         eval device='$HDTUNE_'$idx'_DEVICE'
         eval time='$HDTUNE_'$idx'_SLEEPTIME'
         eval speed='$HDTUNE_'$idx'_PERFORMANCE'
         eval io_access='$HDTUNE_'$idx'_32BIT'
         eval dma_access='$HDTUNE_'$idx'_DMA'
         eval acoustic='$HDTUNE_'$idx'_ACOUSTIC'
         params=''
         >$tmp

         # calculate sleeptime-parameter
         if [ "$time" != "0" ]
         then
             if [ "$time" -ge 300 ]
             then
                 mecho -warn "a timeout above five hours is not 
supported, changed to five hours"
                 sleep 5
                 sleep=250
             elif [ "$time" -gt 20 ]
             then
                 time=`/usr/bin/expr $time - 1`
                 sleep=`/usr/bin/expr $time / 30 + 241`
             else
                 sleep=`/usr/bin/expr $time \* 60 / 5`
             fi

             if `/sbin/hdparm -i /dev/$device >/dev/null 2>&1`
             then
                 params="-S$sleep"
             fi
         fi

         if [ "$speed" = "yes" ]
         then
             # activate lookahead
             lookahead=`/sbin/hdparm -I /dev/$device 2>/dev/null | grep 
'Look-ahead'`
             if [ -n "$lookahead" ]
             then
                 params="$params -A1"
             fi

             case $device in
             hd*)
                 # get maximum multiple sector count from device
                 maxmult=`/sbin/hdparm -i /dev/$device 2>/dev/null | 
grep MaxMultSect | sed 's/,//g'`
                 if [ -n "$maxmult" ]
                 then
                     for i in $maxmult
                     do
                         echo $i | grep MaxMultSect > /dev/null
                         if [ "$?" = "0" ]
                         then
                             maxmultsect=`echo $i | cut -d = -f2`
                         fi
                     done

                     if [ "$maxmultsect" -gt 2 -a "$maxmultsect" -le 64 ]
                     then
                         params="$params -m$maxmultsect"
                     fi
                 fi
                 ;;
             esac
         fi

         case $device in
         hd*)
             params="-a4"

             if [ "$io_access" = yes ]
             then
                 params="$params -c1"
             fi

             if [ "$dma_access" = yes ]
             then
                 params="$params -d1"
             fi
             ;;
         esac

         if [ "$acoustic" != "" ]
         then
             ac=`/sbin/hdparm -I /dev/$device 2>/dev/null | grep 'Acoustic'`
             if [ -n "$ac" ]
             then
                 params="$params -M$acoustic"
             fi
         fi

         cfmedia=`/sbin/hdparm -i /dev/$device 2>/dev/null | grep 
nonMagnetic`
         if [ "$cfmedia" = "" ]
         then
             if [ "$params" != "" ]
             then
                 /sbin/hdparm $params /dev/$device > $tmp
                 if [ "$?" != "0" ]
                 then
                     cat $tmp
                     mecho -error "*** ERROR: Disk $device does not 
support your HDTUNE-Settings. ***"
                     sleep 5
                 fi
             fi
         else
             mecho -warn "*** WARNING: Disk $device is not a harddisk, 
Operation not supported ***"
         fi

         message=`cat $tmp`
         if [ -n "$message" ]
         then
             /usr/bin/logger -s -t "hdtune" -f $tmp
         fi

         idx=`/usr/bin/expr $idx + 1`
     done
#fi

# undocumented function: use at your own risk!
# you can set the maximum rotation speed of a cdrom here
# hdparm -E 4 /dev/hda

rm $tmp
set +x

-- 
der tom
[eisfair-team]


Mehr Informationen über die Mailingliste Eisfair