LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 09-28-2010, 04:31 PM   #1
goplexian
LQ Newbie
 
Registered: Jan 2010
Location: Vancouver, Canada
Distribution: Archlinux
Posts: 5

Rep: Reputation: 0
Post 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
 
Old 09-29-2010, 06:34 AM   #2
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
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.

Last edited by H_TeXMeX_H; 09-29-2010 at 06:38 AM.
 
Old 09-29-2010, 07:08 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,551
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by H_TeXMeX_H View Post
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 ...
 
Old 09-29-2010, 08:05 AM   #4
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
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

Last edited by H_TeXMeX_H; 09-29-2010 at 08:06 AM.
 
1 members found this post helpful.
Old 09-30-2010, 07:50 AM   #5
goplexian
LQ Newbie
 
Registered: Jan 2010
Location: Vancouver, Canada
Distribution: Archlinux
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by H_TeXMeX_H View Post
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.
 
Old 09-30-2010, 09:17 AM   #6
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
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.
 
Old 09-30-2010, 09:30 AM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047
Quote:
Originally Posted by goplexian View Post
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?
 
Old 09-30-2010, 05:16 PM   #8
goplexian
LQ Newbie
 
Registered: Jan 2010
Location: Vancouver, Canada
Distribution: Archlinux
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by TobiSGD View Post
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.
 
Old 10-02-2010, 06:13 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,551
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by H_TeXMeX_H View Post
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.
 
Old 10-02-2010, 07:58 AM   #10
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
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'.
 
1 members found this post helpful.
Old 10-02-2010, 08:26 AM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,551
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
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
... ?
 
Old 10-02-2010, 08:31 AM   #12
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
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.
 
Old 10-02-2010, 10:49 AM   #13
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,551
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Maybe that's what I was dimly recalling -- that the AHCI interface allows Linux to by-pass the BIOS settings ... ?
 
Old 10-02-2010, 11:20 AM   #14
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
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.
 
Old 10-02-2010, 11:51 PM   #15
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,551
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
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.
 
  


Reply

Tags
guide, hardware, linux, performance, tutorial


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Improving the performance !!! kshkid Programming 9 12-20-2006 12:23 PM
Tips on installing Linux on a seperate hard drive? cragwolf Slackware - Installation 3 07-28-2004 05:16 AM
improving 3d performance ababkin Linux - Hardware 1 04-08-2004 11:33 PM
Improving hd performance psyklops Linux - General 2 08-21-2003 08:19 PM
hard drive performance bynaar Slackware 2 12-18-2002 06:21 AM


All times are GMT -5. The time now is 02:10 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration