LFS Hdparm

From VDR Wiki

Jump to: navigation, search

Contents

[edit] Description

HDParm makes it possible to activate the DMA mode for ATAPI hard disks and CD/DVD drives as well as writers. Even though there exists the kernel option

use DMA by default

this tool is useful nonetheless.

[edit] Installation

Hdparm

cd $SOURCEDIR
tar xvfz hdparm-<VERSION>.tar.gz
cd hdparm-<VERSION>
patch -Np1 -i ../hdparm-5.5-glibc_CVS-1.patch
make 
make install

[edit] Parameter

Some useful parameter of HDParm

Parameter Description
-c Abfrage/on/off 32bit I/O
-d Abfrage/on/off DMA Mode
-v Anzeige Einstellungen Laufwerk
-X08 PIO-Mode 0
-X09 PIO-Mode 1
-X10 PIO-Mode 2
-X11 PIO-Mode 3
-X12 PIO-Mode 4
-X32 Multiword DMA mode 0
-X33 Multiword DMA mode 1
-X34 Multiword DMA mode 2
-X66 UDMA 33 =X(64+udma2)
-X67 UDMA 50 =X(64+udma3), seldom used
-X68 UDMA 66 =X(64+udma4)
-X69 UDMA 100 =X(64+udma5)
-X70 UDMA 133 =X(64+udma6)

[edit] Example

  • Drive settings for UDMA100 with 32Bit access for device /dev/hda
hdparm -d1 -c1 -X69 /dev/hda

[edit] Configuration

HDParm can be stated through some start script in /etc/rc.d/init.d.

Here is an example: /etc/rc.d/init.d/set_dma

#!/bin/sh
# begin of /etc/rc.d/init.d/set_dma
# parses ide dma settigs from /etc/sysconfig/idedma.rc
#

source /etc/sysconfig/rc
source $rc_functions

test -e $IDEDMA_RC_CONFIG && source $IDEDMA_RC_CONFIG

case "$1" in
    start)
 echo  "Switch UDMA Mode on:"
 for dev in $IDEDMA_DEVICES; do
   echo  "drive: $dev";
    set +o verbose
   hdparm -d1 /dev/$dev >>/dev/null
 done
 evaluate_retval
 ;;
    stop)
 echo  "Switch UDMA Modus off:"
 for dev in $IDEDMA_DEVICES; do
   echo  "drive: $dev"
          set +o verbose
   hdparm -d0 /dev/$dev >>/dev/null
 done
 evaluate_retval
 ;;
    status)
 echo "DMA Mode: "
 success=false
 for dev in $IDEDMA_DEVICES; do
     if [ -a /proc/ide/$dev/media ] ; then
  if [ `cat /proc/ide/$dev/media` == "disk" ] ; then
      echo `hdparm -d /dev/$dev 2>/dev/null`|grep .
  fi
     fi
     if [ -a /proc/ide/$dev/media ] ; then
  if [ `cat /proc/ide/$dev/media` == "cdrom" ] ; then
      echo `hdparm -d /dev/$dev 2>/dev/null`|grep .
  fi
     fi
        done
 ;;
    *)
 echo "Usage: $0 {start|stop|status]}"
 exit 1
 ;;
esac

test "$return" = "$rc_done" || exit 1
exit 0

For which drives DMA should be activated is set in /etc/sysconfig/ide_dma.rc

# begin of /etc/sysconfig/ide_dma.rc
# 
# Configuration file for ide dma mode support:
# which ide devices should support DMA?
# 
IDEDMA_DEVICES="hda hdb hdc hdd"

Afterwards two links are set

ln -sf  /etc/rc.d/init.d/set_dma /etc/rc.d/rcsysinit.d/S41set_dma
ln -sf  /etc/rc.d/init.d/set_dma /etc/rc.d/rc0.d/K15set_dma

[edit] Links

[1] http://www.linuxfromscratch.org/patches/blfs/5.1/hdparm-5.5-glibc_CVS-1.patch hdparm Patch
[2] http://www.ibiblio.org/pub/Linux/system/hardware Download
Personal tools
Participate
In other languages