MandrakeUser.Org - Your Mandrake-Linux Knowledge Base!


 
 

*DocIndex - Hardware

IDE HDs II

* RAID
* S.M.A.R.T.
* Performance Tuning

Related Resources:

man smartctl
man hdparm
Speeding up Linux Using hdparm
HOWTO: Multi Disk System Tuning

Revision / Modified: Dec. 18, 2001 / Feb. 13, 2002
Author: Tom Berger

 

* RAID

RAID (Redundant Arrays of Independent Disks) comes various flavors, with RAID-0 (striping) and RAID-1 (mirroring) being the most common. RAID can either be done in hardware (using a controller like the ubiquitous PROMISE RAID chips and controllers) or in software.

On-board RAID controller chips by Promise (e.g. on the Asus A7V) should get detected by the installer and work. The HPT368 (UDMA/66 RAID) should work, too, but might require some special boot loader parameters (read the 'HPT366 chipset support' paragraph in /usr/src/linux/Documentation/Configure.help).
If you want to use a controller card, you will usually have to download and install drivers from the vendor's page. The IDE controller list on linhardware.net has more information on this topic. Another valuable source of information is RAID solutions for Linux.

* section index * top

* S.M.A.R.T.

S.M.A.R.T. is the 'Self-Monitoring, Analysis and Reporting Technology' used in most modern IDE hard drives. It is used to check the reliability of the drive and predict drive failures. To put this technology to use in GNU/Linux, you need to enable S.M.A.R.T. in your system's BIOS and you need a program like the UCSC S.M.A.R.T. Suite or ide-smart ( Mandrake Contrib RPM). They allow you to run tests (even periodically) and will warn you, if drive parameters drift out of range (indicating an upcoming drive failure).

Handling is very simple (as 'root'):

ide-smart -d /dev/[device] -q

will run a quiet test, only returning messages if there was an error.

* section index * top

* Performance Tuning

  1. The first rule is to refrain from connecting any kind of slave device to a port which already has an IDE master disk. If you really need a second disk, use the second port, and if you've already got a CD/DVD there, get a controller card.

  2. The second rule is to keep cables as short as possible. The longer the cable the higher the possibility of data transfer errors.

  3. More RAM ;-). GNU/Linux makes a generous use of RAM for caching disk accesses. Low memory resources will lead to thrashing (i.e. swapping memory to and from the hard disk). Yes, there is the swap file, but the best swap file is an unused swap file!

  4. Think big! Larger disks are (usually) faster. Remember however that more speed in most cases also means more heat and more noise.

The rest is done via 'hdparm'. If you have a look at 'hdparm's man page, you might feel slightly uneasy: lots of options and every now and then disheartening messages like Use with extreme caution! or may result in severe file system corruption!.
Those of you who are familiar with M's history might remember the infamous 6.0 initscript bug, where a 'hdparm' parameter lead to freezes on some systems.
Later on, using 'hdparm' optimization became an installation option along with an appropriate warning. It has been removed again since because it caused trouble on some systems.

It isn't all that dangerous provided you know what you are doing and if you use the right options. And the disk speed will increase significantly even with the conservative settings I'm going to describe here.

hdparm -i /dev/hd[x] will tell you everything you need to know about your hard disk(s), like model name, geometry, supported (U)DMA and PIO modes. The currently active transfer mode is marked with an asterisk (*).

hdparm /dev/hd[x] shows you adjustable parameters and their current setting.

hdparm -Tt /dev/hd[x] runs a benchmark. Knowing benchmarks, you should run several of them to get meaningful results. You can ignore the 'Timing buffer-cache reads' value, this one varies widely even within minutes. Really important is the second value, 'Timing buffered disk reads'. I will refer to this value in the next section.

Optimization Examples

Since I usually use hdparm, I've set all parameters to '0', which turns them off. In this setting I get around 3.5 MB/sec.
I turn on 32-bit I/O support. I'm using setting '3' which is slightly slower than '1' but more secure:

hdparm -c3 /dev/hda

Now the benchmark shows a value around 5.8 MB which is already a significant increase.

What about (U)DMA?

hdparm -d1 /dev/hda

The benchmark takes a huge leap up to 15 MB/sec. Note that this command will automatically put the drive to the highest available transfer mode (UDMA/33 here), so there is no need to specify the -X34 option.

And that's all there is to it: hdparm -c3d1 /dev/hda. Other settings like -m16 (enabling multiple sector count) or -u1 (unmasking interrupt) have no effect whatsoever, but might even be dangerous.

You might have heard about the hd[x]=autotune boot parameter. This also shows no effect here.

Mandrake Linux user Roger shares his thoughts:

"One could either add to '/etc/lilo.conf':

append=" hda=dma hdb=dma hdd=ide-scsi quiet hdc=ide-floppy opti"

I'm also seeing some other options for the append line in 'lilo.conf' such asidex=ata66, but I have yet to have time to grep the kernel source or test this option to see if it works.
Or, for Mandrake 8.1, I added a new file, called '/etc/rc.d/init.d/hdparm-settings':

#Tweak drives for best speeds!
#WDC WD273BA          27.3GB 66MB/sec    7200RPM    UDMA4
hdparm -c1 -m0 -d1 -X68 -S253 /dev/hde

# WDC WD400BB-00AUA1     40GB   100MB/sec   7200RPM UDMA5
hdparm -c1 -m0 -d1 -X69 -S253 /dev/hdg

# WDC WD102BA 10.2GB    66MB/sec    7200RPM UDMA4
hdparm -c1 -m0 -d1 -X68 -S253 /dev/hdf

Now, add this to your run level.  I used /usr/bin/ksysv (as root) to add this to my run-level 5.  An easier and less messy way of doing this is just adding these few lines anywhere inside your '/etc/rc.d/rc.local', only con is that it will execute at the end of the boot process. Since I have ultra dma hdd's, I enabled udma option by adding the "-X" option.  Not well documented in the man page of hdparm, so here's the options for "-X":

33    multiword DMA mode1
66 UDMA2
68    UDMA4 (My two Ultra66 hdd's support this)
69    UDMA5 (My Ultra100 hdd supports this)

To find out of which your hdd supports & is currently set to, do the following:

# hdparm -i /dev/hdx
DMA modes: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5

There's another option called multcount, but enabling this to either 8 or 16, resulted in a loss of tx speeds in my drives.  Read the man page for hdparm for more info.
I'm also not seeing much in improvement by enableing UDMA4/5 but, my drives support it so why not? Eh? Just be advised that messing with these options could cause corruption with your filesystem, so be safe and make regular backups. The '-c' option is obsolete from what I've just read.  It was mainly used on drives prior to 66/100 drives. The '-S240' option is not needed...it only sets the 'sleep option' for the hdd's to ~20 minutes."

Mandrake Linux user Hoyt Duff adds:

"You might want to give the boot option ide0=0x1f0 a try. It forces the use of a more modern IDE driver. Also,floppy=daring can really speed up modern floppy drives -- 'mtools' just zip along."

Sleep Mode

hdparm not only optimizes speed but also allows you to define a standby timeout (hdparm -S[xxx]), after which your drive will spin down to save power. The values follow a somewhat peculiar scheme, which is explained in man hdparm.

Notice that the hard drive 'sleep' function puts a great deal of mechanical strain on the hard drive when 'waking it up'. Furthermore does the Linux drive access cache prevent a drive with mounted partitions on it from going into 'sleep' mode. The 'noflushd' package from your Mandrake Linux CD enables you to work around that. You should make sure to its man page before using it, though.

Once you've found a suitable setting, execute the 'hdparm' command again, adding the 'k' option. This will preserve your settings beyond the current session.

* section index * top

 
Legal: All texts on this site are covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB (Tom Berger) and Mandrakesoft 1999-2002.