diff --git a/README.md b/README.md index ebd7066..95c9d44 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,6 @@ # hdparm +Hdparm is a useful system utility for setting (E)IDE hard drive parameters. +For example, hdparm can be used to tweak hard drive performance and to spin +down hard drives for power conservation. + diff --git a/hdparm-initscript b/hdparm-initscript new file mode 100644 index 0000000..8c81ed1 --- /dev/null +++ b/hdparm-initscript @@ -0,0 +1,70 @@ +#!/bin/bash +# Hdparm initscript - Turn on harddisk optimization +# Copyright (C) 2004-2005 Silvan Calarco +# Copyright (C) 2004-2005 Davide Madrisan +# +# hdparm: Set hard disk parameters +# chkconfig: 2345 09 93 +# description: Set hard disk parameters + +. /etc/sysconfig/rc +. $rc_functions + +# There is only one file /etc/sysconfig/harddisks for all disks after +# installing the hdparm package. +# If you need different hdparm parameters for each of your disks, copy +# /etc/sysconfig/harddisks to /etc/sysconfig/harddiskhda (hdb, hdc...) +# and modify it. +# Each disk which has no special parameters will use the defaults. +# For each cdrom only the 'EIDE_32BIT' parameter will be used + +case "$1" in +start) + [ -x /sbin/hdparm ] || exit 0 + + for device in $(find /dev/hd[a-z] -printf "%f " 2>/dev/null); do + unset MULTIPLE_IO USE_DMA EIDE_32BIT LOOKAHEAD EXTRA_PARAMS + if [ -r /etc/sysconfig/harddisk${device} ]; then + . /etc/sysconfig/harddisk${device} + else + # use default values + [ -r /etc/sysconfig/harddisks ] && . /etc/sysconfig/harddisks + fi + + unset HDFLAGS + if [ -r "/proc/ide/$device/media" ]; then + case "$(cat /proc/ide/$device/media)" in + "disk") + [ "$MULTIPLE_IO" ] && + HDFLAGS="-q -m$MULTIPLE_IO" + [ "$USE_DMA" ] && + HDFLAGS="$HDFLAGS -q -d$USE_DMA" + [ "$EIDE_32BIT" ] && + HDFLAGS="$HDFLAGS -q -c$EIDE_32BIT" + [ "$LOOKAHEAD" ] && + HDFLAGS="$HDFLAGS -q -A$LOOKAHEAD" + [ "$EXTRA_PARAMS" ] && + HDFLAGS="$HDFLAGS $EXTRA_PARAMS" + ;; + "cdrom") + [ "$EIDE_32BIT" ] && + HDFLAGS="$HDFLAGS -q -c$EIDE_32BIT" + ;; + esac + fi + [ "$HDFLAGS" ] && + action $"Setting hard drive parameters for $device: " \ + /sbin/hdparm $HDFLAGS /dev/$device + done +;; +restart) + $0 start +;; +stop) + exit 0 +;; +*) + echo "Usage: $0 {start|stop|restart}" + exit 1 +;; +esac diff --git a/hdparm-sysconfig b/hdparm-sysconfig new file mode 100644 index 0000000..9852ce0 --- /dev/null +++ b/hdparm-sysconfig @@ -0,0 +1,36 @@ +# These options are used to tune the hard drives - +# read the hdparm man page for more information + +# Set this to 1 to enable DMA. This might cause some +# data corruption on certain chipset / hard drive +# combinations. This is used with the "-d" option + +USE_DMA=1 + +# Multiple sector I/O. a feature of most modern IDE hard drives, +# permitting the transfer of multiple sectors per I/O interrupt, +# rather than the usual one sector per interrupt. When this feature +# is enabled, it typically reduces operating system overhead for disk +# I/O by 30-50%. On many systems, it also provides increased data +# throughput of anywhere from 5% to 50%. Some drives, however (most +# notably the WD Caviar series), seem to run slower with multiple mode +# enabled. Under rare circumstances, such failures can result in +# massive filesystem corruption. USE WITH CAUTION AND BACKUP. +# This is the sector count for multiple sector I/O - the "-m" option +# +MULTIPLE_IO=16 + +# (E)IDE 32-bit I/O support (to interface card) +# +EIDE_32BIT=3 + +# Enable drive read-lookahead +# +# LOOKAHEAD=1 + +# Add extra parameters here if wanted +# On reasonably new hardware, you may want to try -X66, -X67 or -X68 +# Other flags you might want to experiment with are -u1, -a and -m +# See the hdparm manpage (man hdparm) for details and more options. +# +EXTRA_PARAMS= diff --git a/hdparm.spec b/hdparm.spec new file mode 100644 index 0000000..cb472b7 --- /dev/null +++ b/hdparm.spec @@ -0,0 +1,143 @@ +Name: hdparm +Version: 9.43 +Release: 1mamba +Summary: A utility for displaying and/or setting IDE hard disk parameters +Group: System/Kernel and Hardware +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://sourceforge.net/projects/hdparm/ +Source0: http://downloads.sourceforge.net/hdparm/hdparm-%{version}.tar.gz +Source1: hdparm-sysconfig +Source2: hdparm-initscript +License: BSD +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +## AUTOBUILDREQ-END +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +Hdparm is a useful system utility for setting (E)IDE hard drive parameters. +For example, hdparm can be used to tweak hard drive performance and to spin +down hard drives for power conservation. + +%prep +%setup -q + +%build +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +install -d %{buildroot}/sbin +install -d %{buildroot}%{_initrddir} +install -d %{buildroot}%{_sysconfdir}/rc.d/rcsysinit.d +install -d %{buildroot}%{_sysconfdir}/sysconfig +install -d %{buildroot}%{_mandir}/man8 + +%makeinstall + +cp %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/harddisks +install -m 744 %{SOURCE2} %{buildroot}%{_initrddir}/hdparm +ln -s ../init.d/hdparm %{buildroot}%{_sysconfdir}/rc.d/rcsysinit.d/S35hdparm + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files +%defattr(-,root,root) +/sbin/hdparm +%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/harddisks +%{_initrddir}/hdparm +%{_sysconfdir}/rc.d/rcsysinit.d/* +%{_mandir}/man8/* +%doc Changelog LICENSE.TXT README.acoustic + +%changelog +* Sat Nov 24 2012 Automatic Build System 9.43-1mamba +- automatic version update by autodist + +* Thu Oct 11 2012 Automatic Build System 9.42-1mamba +- automatic version update by autodist + +* Wed Aug 08 2012 Automatic Build System 9.39-1mamba +- automatic version update by autodist + +* Fri Jan 13 2012 Automatic Build System 9.38-1mamba +- automatic version update by autodist + +* Mon Jan 31 2011 Automatic Build System 9.37-1mamba +- automatic update by autodist + +* Sun Nov 14 2010 Automatic Build System 9.36-1mamba +- automatic update by autodist + +* Wed Nov 10 2010 Automatic Build System 9.35-1mamba +- automatic update by autodist + +* Sat Sep 18 2010 Automatic Build System 9.30-1mamba +- automatic update by autodist + +* Thu Jul 08 2010 Automatic Build System 9.29-1mamba +- automatic update by autodist + +* Fri Mar 12 2010 Automatic Build System 9.28-1mamba +- automatic update by autodist + +* Tue Aug 18 2009 Automatic Build System 9.25-1mamba +- automatic update by autodist + +* Tue Aug 04 2009 Automatic Build System 9.22-1mamba +- automatic update by autodist + +* Fri Jul 17 2009 Automatic Build System 9.16-1mamba +- automatic update by autodist + +* Thu May 07 2009 Automatic Build System 9.15-1mamba +- automatic update by autodist + +* Sat Oct 18 2008 gil 8.9-1mamba +- update to 8.9 + +* Wed Mar 08 2006 Silvan Calarco 6.6-1qilnx +- update to version 6.6 by autospec + +* Mon Feb 27 2006 Silvan Calarco 6.3-1qilnx +- update to version 6.3 by autospec + +* Tue Oct 18 2005 Davide Madrisan 6.1-1qilnx +- update to version 6.1 by autospec +- specfile updates: fixed package group and license, use rpm macros +- initscript rewritten +- %%post script removed (hdparm can cause data corruption if executed with + mounted disks) + +* Mon Mar 29 2004 Davide Madrisan 5.5-3qilnx +- postun script removed (during package updates the restart of hdparm may + hang the QiLinux box) + +* Mon Mar 08 2004 Davide Madrisan 5.5-2qilnx +- modified initscript and fixed a visualisation problem + +* Thu Mar 04 2004 Davide Madrisan 5.5-1qilnx +- new version rebuit + +* Fri Nov 22 2003 Silvan Calarco 5.4-4qilnx +- removed chkconfig execution (it now starts in rc.sysinit phase) +- added rcsysinit.d service symlink + +* Wed Nov 18 2003 Silvan Calarco 5.4-3qilnx +- changed service precedence from 10 to 09 + +* Wed Nov 12 2003 Silvan Calarco 5.4-2qilnx +- added hdparm own initscript + +* Wed Oct 15 2003 Silvan Calarco 5.4-1qilnx +- new version rebuild + +* Tue May 20 2003 Silvan Calarco 5.3-2qilnx +- added sysconfig configuration file (harddisks) + +* Wed Apr 16 2003 Alessandro Ramazzina +- creation of hdparm package