Hard disk acceleration: hdparm
Warning! Hard disk acceleration can destroy your data!
No kidding here
Even though it works on most of the computers (for example, it works in my computer), in same cases, it is known that it has corrupted some data from a hard disk. So, before starting disk optimization, I recommend you to, first, verify that your Kernel supports the chipset on your computer; second, verify that your chipset is supported in the kernel (not as a module); third, backup your data; forth, use this acceleration under your responsability.
Hard Discs in Linux
First, it will ve good to know our hard disk specifications. Check that you have hdparm installed in your system (try running it as root, alone, with no parameters at all.) Just to have it all clear, let's start with Linux naming convention for hard disks.
On Linux, hard disks are not nammed "C:" ni "D:" ni .... On Linux, they are named hda, hdb, hdc... (this is for IDE hard disks; SCSI disks have different names). I only have used hdparm with IDE disks, so I cannot give advice on how to work with SCSI disks. To know the proper Linux name for a given hard disks, use this table:
You can use the following commands in order to get knowledge from our hard disks and CD-ROM units. Use them as root . Replace the X by the letter that corresponds with your unit, as shown in the previous table.
[root@sal10000 root]#hdparm /dev/hdX
The first command will inform you of the status (active or non-active) of hdparm's each and every option. Whenever you get a zero, the option is not active. Whenever you get an one, the option is active. With the first command, in my computer, I get the following:
The second command tells you the specifications of your hard disk drive. It will show you the kind of LBA type supported by your drive, the "Cylinders/Heads/Sectors", "PIO Modes", "DMA Modes"... available for your disk. This way, you can know what performance level can be achieved by your drive. With the second command, in my computer, I get the following:
[root@sal10000 root]# hdparm -i /dev/hda
To discover your drive's transference speed, close all aplications, servers... that you might have active on your system (even the graphical mode; exit your window environment, go to a virtual console with Ctrl+Alt+F1, login as root and issue the command telinit 3). Then, issue the command (as root and changing X by the letter that applies to your drive, as explained before with the Linux name table). Do it at least 5 times. Discard the higheest and lowest results, and your speed will be the average of the other values.
hdparm -t /dev/hdX
There's a whole bunch of adjustable parameters. To know about all of them, issue the command hdparm -? . The values that affect the most your drive's speed are:
Small guide to testing:
Maybe you will discover that your drive is already optimized (as happens with some of the most modern and "user friendly" Linux distributions) and you do not need to modify anything.
Save the Configuration
If you decide to use, let's say, -c1 -d1 /dev/hda and you want to avoid typing this each and every time that you boot up your computer, you will need to insert the command in some boot script. In my Linux, it is: /etc/rc.d/rc.local (it is distribution-dependent. Check your documentation). So, edit that file (as root) and add a line in the end that says hdparm -c1 -d1 /dev/hda.