LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   6 tips for improving hard drive performance (http://www.linuxquestions.org/questions/linux-hardware-18/6-tips-for-improving-hard-drive-performance-835034/)

goplexian 09-28-2010 04:31 PM

6 tips for improving hard drive performance
 
Hi LinuxQuestions!

I thought some of you might enjoy this guide I put together about improving hard drive performance in Linux.

Fairly standard stuff but hopefully it will be useful for some of you.

Feedback is welcome.

Alex

H_TeXMeX_H 09-29-2010 06:34 AM

Well, I don't think that this applies to most users, because I don't know of too many people that setup RAID5 just for the performance part of it. Technically, I was considering it, but came to the conclusion that it is a silly idea. A much better idea is to get a RAM disk (for example) and use it as an intermediate workspace for files. This is all in theory, of course. I don't think this article is focused on HDD performance per-se.

#6 (noatime) is the only one that is indeed useful, I already use it.

He didn't even mention that there exist other filesystems, like XFS and JFS that have greater performance than ext4. Nor, did he mention the I/O scheduler, which is extremely important in some cases. For example JFS + deadline is a great high-performance combo, whereas using CFQ is not in this case. CFQ works well with other filesystems tho.

What about the SATA drivers ? What mode is the SATA controller in ? This can be important, I've seen some SATA drivers give horrible performance, which can be solved by switching to AHCI. For IDE you can tweak the options using hdparm to squeeze out some more performance.

catkin 09-29-2010 07:08 AM

Quote:

Originally Posted by H_TeXMeX_H (Post 4112457)
What about the SATA drivers ? What mode is the SATA controller in ? This can be important, I've seen some SATA drivers give horrible performance, which can be solved by switching to AHCI.

Do the BIOS settings matter or does Linux by-pass them and go direct to the hardware? To be more explicit, I've set On Chip SATA Type: Native IDE in the BIOS (for WXP running on the real hardware) and seen boot messages and /var/log/ files reporting discovering SATA controllers. Vague recollections of seeing a technical article about the kernel using "bus enumeration" to discover the likes of SATA controllers, too ...

H_TeXMeX_H 09-29-2010 08:05 AM

Well, the SATA controller will be discovered if there are drivers that support it. For example, if you are in IDE/PATA mode you will see drivers like pata_marvell being loaded or pata_*. If you are in SATA mode, you'll see sata_sis being loaded or sata_*. If you are in AHCI mode, only one driver should be loaded: ahci.

So, no Linux cannot bypass the BIOS settings, instead it loads drivers based upon the settings.

Now, I don't actually know exactly which drivers will be loaded with each mode, the only one I'm sure about is AHCI mode will always load ahci module.

* = another chipset

goplexian 09-30-2010 07:50 AM

Quote:

Originally Posted by H_TeXMeX_H (Post 4112457)
Well, I don't think that this applies to most users, because I don't know of too many people that setup RAID5 just for the performance part of it. Technically, I was considering it, but came to the conclusion that it is a silly idea. A much better idea is to get a RAM disk (for example) and use it as an intermediate workspace for files. This is all in theory, of course. I don't think this article is focused on HDD performance per-se.

#6 (noatime) is the only one that is indeed useful, I already use it.

He didn't even mention that there exist other filesystems, like XFS and JFS that have greater performance than ext4. Nor, did he mention the I/O scheduler, which is extremely important in some cases. For example JFS + deadline is a great high-performance combo, whereas using CFQ is not in this case. CFQ works well with other filesystems tho.

What about the SATA drivers ? What mode is the SATA controller in ? This can be important, I've seen some SATA drivers give horrible performance, which can be solved by switching to AHCI. For IDE you can tweak the options using hdparm to squeeze out some more performance.


I don't think raid is silly.

Is doing backup's silly?

Are faster disk drives silly?

I've never heard anyone who has actually setup raid5 complain that they didn't like it after it was setup, and its not even that hard to setup.

You should give it a try before you knock it.

H_TeXMeX_H 09-30-2010 09:17 AM

Again, I was thinking about it, but rather than buy 2 more drives just like this one, maybe I should invest in a RAM disk.

TobiSGD 09-30-2010 09:30 AM

Quote:

Originally Posted by goplexian (Post 4113694)
I don't think raid is silly.

He did not say that RAID is silly. He said that he thinks to set up a RAID 5 for performance gains is silly (what is exactly my opininion, too). If I want performance, I set up a RAID 0, in fact I have one over three disks, and it is running like hell.
Quote:

Is doing backup's silly?

Are faster disk drives silly?
What does that have to do with it?
Quote:

I've never heard anyone who has actually setup raid5 complain that they didn't like it after it was setup, and its not even that hard to setup.
Most people will set up RAID 5 to avoid downtimes in case of disk failure, not to gain speed improvements. So why should they complain?

goplexian 09-30-2010 05:16 PM

Quote:

Originally Posted by TobiSGD (Post 4113817)
He did not say that RAID is silly.

OK I wasn't trying to get into an argument, I was just trying to point out that it is easy to think something is silly before you actually try it.

Raid5 is used because it offers a performance increase in addition to reducing downtime for disk failure.

If a person only cares about disk failure they would be better off using Raid1 instead.

catkin 10-02-2010 06:13 AM

Quote:

Originally Posted by H_TeXMeX_H (Post 4112542)
Well, the SATA controller will be discovered if there are drivers that support it. For example, if you are in IDE/PATA mode you will see drivers like pata_marvell being loaded or pata_*. If you are in SATA mode, you'll see sata_sis being loaded or sata_*. If you are in AHCI mode, only one driver should be loaded: ahci.

So, no Linux cannot bypass the BIOS settings, instead it loads drivers based upon the settings.

Now, I don't actually know exactly which drivers will be loaded with each mode, the only one I'm sure about is AHCI mode will always load ahci module.

* = another chipset

Thanks H_TeXMeX_H :) After changing the BIOS "On Chip SATA Type" from "Native IDE" to "SATA->AHCI" the only difference identified as relating to the HDDs in /var/log/messages was this extra message: "kernel: pci 0000:00:12.0: set SATA to AHCI mode".

I guess that is a "Good Thing" but I don't have any performance figures to measure it with.

H_TeXMeX_H 10-02-2010 07:58 AM

Well, when implemented properly AHCI does allow for NCQ and hotplugging. At least NCQ can improve performance.
http://en.wikipedia.org/wiki/Native_Command_Queuing

To see if ncq is enabled run 'dmesg | grep ncq'.

catkin 10-02-2010 08:26 AM

Thanks :) Seems NCQ is enabled:
Code:

root@CW8:~# dmesg | grep ncq
ahci 0000:00:12.0: flags: ncq sntf ilck pm led clo pmp pio slum part

but it was enabled before changing the BIOS setting this evening:
Code:

root@CW8:/var/log# grep ncq messages | tail
Sep 30 22:43:51 CW8 kernel: ahci 0000:00:12.0: flags: ncq sntf ilck pm led clo pmp pio slum part
Sep 30 23:07:55 CW8 kernel: ahci 0000:00:12.0: flags: ncq sntf ilck pm led clo pmp pio slum part
Oct  1 07:22:01 CW8 kernel: ahci 0000:00:12.0: flags: ncq sntf ilck pm led clo pmp pio slum part
Oct  1 12:00:58 CW8 kernel: ahci 0000:00:12.0: flags: ncq sntf ilck pm led clo pmp pio slum part
Oct  1 18:35:25 CW8 kernel: ahci 0000:00:12.0: flags: ncq sntf ilck pm led clo pmp pio slum part
Oct  2 06:54:56 CW8 kernel: ahci 0000:00:12.0: flags: ncq sntf ilck pm led clo pmp pio slum part
Oct  2 16:21:19 CW8 kernel: ahci 0000:00:12.0: flags: ncq sntf ilck pm led clo pmp pio slum part

... ? :confused:

H_TeXMeX_H 10-02-2010 08:31 AM

Well, the message comes from the AHCI module, so it must have been using it already. It could be the BIOS allows AHCI to work even in the other modes. I would check what modules are loaded in each mode.

catkin 10-02-2010 10:49 AM

Maybe that's what I was dimly recalling -- that the AHCI interface allows Linux to by-pass the BIOS settings ... ?

H_TeXMeX_H 10-02-2010 11:20 AM

It's possible. I only found what I said out by looking at what modules were loaded in each mode. I found that in AHCI mode I only needed the ahci module and nothing else.

Also note that there may be more than one SATA controller on the system. On mine I have only one, but on a Gigabyte board I have, it has two, an Intel and a JMicron one, with independent BIOS settings.

catkin 10-02-2010 11:51 PM

I did a thorough netsearch for ACPI and "bus enumeration" plus several variants but found nothing so it is unlikely that ACPI itself does bus enumeration.


All times are GMT -5. The time now is 06:51 PM.