Welcome

You have reached the blog of Keith Elder. Thank you for visiting! Feel free to click the twitter icon to the right and follow me on twitter.

HDPARM – The Hard Drive Utility

Posted by Keith Elder | Posted in Linux, PC Software | Posted on 26-09-2000

“If you have an older machine, or even a newer machine with a new ATA/33 or ATA/66 hard drive, did you know that you are probably not even using it to its full capacity? It is true that most motherboard IDE chipsets are not directly supported by the Linux kernel. However, with a little tweaking, you can take full advantage of the new chipsets and even improve overall system performance.

Give me the facts
hdparm – get/set hard disk parameters

(zorka@zorka)::(zorka)
(~):hdparm -c3d1m16X66 /dev/hda

 

the above command, you will basically set the parameters on your hard drive to use the built in functions of today’s IDE chipsets that do not get setup for you when Linux is installed. Let’s say we issued the following command “hdparm -t /dev/hda”. This would benchmark our hard drive and produce the following output:

debian:~# hdparm -t /dev/hda

 

As you can see, our hard drive benchmarked a little over 14.07 MB/sec and more than likely if this machine wasn’t running any other processes while it benchmarked itself we would see much higher results, normally around 15 MB/sec for this machine.

does HDPARM do though?
Well, if you want to read about it I suggest doing a “man hdparm” to really get the full scoop. However the above command that we issued “hdparm -c3d1m16X66 /dev/hda” I will breakdown for you and give you a few more pointers. Note: Using this command can crash your machine.

Let’s take them one by one
-c3 = Query/enable (E)IDE 32-bit I/O support. Basically I have found that “-c1” will basically work with just about any board, however “-c3” tends to work better with the newer pentium/k62 chipset motherboards. I have normally seen a difference from .5-1MB in speed using “-c1” and “-c3” (c3 being faster). The values you can pass to the -c option are 0, 1, and 3.

-d1 = Disable/enable the “using_dma” flag for this drive. Of course we want this enabled to take advantage of our Ultra DMA hard drive. This one is pretty simple.

-m16 = Get/set sector count for multiple sector I/O on the drive. We have a lot of choices to use on this option: 0, 2, 4, 8, 16, and 32. There are some indications about using Western Digital hard drives even in the man page for hdparm so if you have a WD drive, please read the man page for more information as to what you should use. To date I have not been able to pass a “32” to the -m option, only “16”. In a nutshell, this feature enabled is suppose to reduce overhead of disk I/O anywhere from 30%-50%.

-X66 = Set the IDE transfer mode for newer (E)IDE/ATA2 drives. If you have a newer ATA/33 or higher hard drive, this is the option that really makes a difference and the one that can also bring your box to a grinding halt. In playing with the hdparm utility, I have crashed several machines. Most of the time it is because I told hdparm that I was running a faster drive than what I had. Example, on my Dell Latitude XPICD laptop, I issue the following command: hdparm -c1d1m16X34. . I normally get about 8MB a second after I benchmark and before I was getting 1.6MB! See what a difference it can make? I am not going to go into detail about how the “66” is derived because you really need to read the man page. However I will tell you that if you have an ATA/33 hard drive or newer you cannot go wrong using the -X66 option. On older drives or machines where you really don’t know what is in it, start with -X33 and if that works keep increasing it and pray the box doesn’t crash.

Conclusion
A lot of people are all about using the latest and greatest hardware in their machines, however, they never really take advantage of it. If your computer takes a long time to startx or to launch Netscape, then more than likely you need hdparm to come to the rescue. Another recommendation is that when you go shopping for a new motherboard, make sure the kernel supports it chipset and compile your kernel with it built in.

 

/dev/hda:
Timing buffered disk reads: 64 MB in 4.5
seconds = 14.07 MB/sec
debian:~#

 

/dev/hda:
setting 32-bit I/O support flag to 3
setting multcount to 16
setting using_dma to 1 (on)
setting xfermode to 66 (UltraDMA mode2)
multcount = 16 (on)
I/O support = 1 (32-bit)
using_dma = 1 (on)

Comments (2)

I need help with setting up hdparm.I have never used it,and i do not know if i should make a bootable floppy or cd or even wich files to use.Can you help understand this utillity?thanks

OK.Somebody talk to me like a dummie!How do i set up hdparm and where do i begin.I have no clue where to start or where to place commands or anything.Can some one please help.I need to unlock my xbox hdd.xbox is gone.

Write a comment