View previous topic :: View next topic |
Author |
Message |
Guest
|
Posted: Fri Apr 12, 2002 12:59 am Post subject: my harddrive performance is sucking |
|
|
here's the situation... I'm reading the following article from OreillyNet:
http://linux.oreillynet.com/pub/a/linux/2000/06/29/hdparm.html
in doing so, I ran the infamous command "hdparm -Tt /dev/hda" and found that:
Timing buffer-cache reads: 128 MB in 6.69 seconds = 19.13 MB/sec
Timing buffered disk reads: 64 MB in 36.16 seconds = 1.77 MB/sec
this seems extremely slow. of course, I was also in KDE and doing an "emerge evolution" command at the same time... will this affect the results? (I will do it again in console mode with no other running commands)
-S |
|
Back to top |
|
|
Guest
|
Posted: Fri Apr 12, 2002 11:15 am Post subject: |
|
|
try
hdparm -c 1 -d 1 /dev/hda
(as root of course)
and do the hdparm -tT /dev/hda check again
my results:
/dev/hdb:
Timing buffer-cache reads: 128 MB in 0.42 seconds =304.76 MB/sec
Timing buffered disk reads: 64 MB in 2.76 seconds = 23.19 MB/sec |
|
Back to top |
|
|
+BroNNoS+ Guest
|
Posted: Mon Apr 15, 2002 4:48 pm Post subject: |
|
|
Is there a way to get this automatically done every time you boot? |
|
Back to top |
|
|
tanksimpson n00b
Joined: 15 Apr 2002 Posts: 5
|
Posted: Mon Apr 15, 2002 6:18 pm Post subject: |
|
|
Yeah, you need to add a line to /etc/conf.d/local.start such as:
hdparm -qc 1 -qd 1 -qk 1 /dev/hda
the "q" before each option tells hdparm not to spit out a bunch of messages you probably dont wanna see every time you boot up. local.start seems to be gentoo's equivalent of rc.local - a good place to tack on some tweaks at start-up. |
|
Back to top |
|
|
Guest
|
Posted: Tue Apr 16, 2002 10:00 pm Post subject: |
|
|
Depending on what options the kernel/ide driver already have set, there are also the "-m XY" and "-u 1" options for hdparm.
If you do a hdparm /dev/hda and the line "multcount = XY" shows XY as > 0 then the "-m" option will have no effect.
If the result from "hdparm /dev/hda" shows this:
...
multcount = 0 (off)
...
Then try with the command "hdparm -m 16 /dev/hda". This will enable multiple sector I/O (block mode). Rerun your benchmark and compare your results.
"-u 1" will not improve your benchmarks but it will improve the overall responsiveness of the system since it unmasks other IRQs while processing the (IDE) command(s).
NOTE !!!
The "-u" and "-m" options *can* cause file system corruption so if you have an older system you should be a bit careful with these options. Kernels >= 2.4 usually fix this for these system if you enabled the "CMD-640" and "RZ1000" bug fixes when you compiled your kernel. Anyway, you should do these tweaks at the beginning of your installation, before you have compiled and configured everything (fast reinstall if things fail ...).
I usually have this at the end of my /etc/conf.d/local.start file:
/sbin/hdparm -qm 16 -qc 1 -qu 1 -qd 1 /dev/hda
16 sectors block mode, 32-bit I/O supprt, unmask IRQs, use DMA. "q" prefix for quiet mode. |
|
Back to top |
|
|
Ozymandias Tux's lil' helper
Joined: 10 Apr 2002 Posts: 81 Location: Netherlands
|
Posted: Wed Apr 17, 2002 3:41 pm Post subject: |
|
|
does anybody know then how I get my disks to talk ata100 ? now I get this in dmesg:
Code: |
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
VP_IDE: VIA vt82c686b (rev 40) IDE UDMA100 controller on pci00:07.1
ide0: BM-DMA at 0xd000-0xd007, BIOS settings: hda:DMA, hdb:pio
ide1: BM-DMA at 0xd008-0xd00f, BIOS settings: hdc:DMA, hdd:pio
hda: Maxtor 2B020H1, ATA DISK drive
hdc: 24X10, ATAPI CD/DVD-ROM drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
hda: 40020624 sectors (20491 MB) w/2048KiB Cache, CHS=2491/255/63, UDMA(33)
hdc: ATAPI 40X CD-ROM CD-R/RW drive, 2048kB Cache, DMA |
but that says UDMA(33) how do I get this to be UDMA(100) ? or is ata100 not related to UDMA? should I use the idebus=100 ? but I assume my PCI isn't 100MHz, just my ata....
Code: |
via src # hdparm -tT /dev/hda
/dev/hda:
Timing buffer-cache reads: 128 MB in 2.66 seconds = 48.12 MB/sec
Timing buffered disk reads: 64 MB in 2.43 seconds = 26.34 MB/sec
Hmm.. suspicious results: probably not enough free memory for a proper test.
|
is what I get now, is this about correct for a 5400 RPM 20 gig disk?
greetz Ozy |
|
Back to top |
|
|
Guest
|
Posted: Wed Apr 17, 2002 7:06 pm Post subject: |
|
|
Do a "hdparm -i /dev/hda" and check what DMA mode your drive is using. Look at the end of the output, you'll see something like this:
"mdam0 mdma1 mdma2 ..." and "udma0 udma1 ..."
The current mode is indicated by a trailing "*" as in "mdma2*".
The various modes are:
mdma0 - 4.2 MB/s
mdma1 - 13.3 MB/s
mdma2 - 16.6 MB/s
udma0 - 16.6 MB/s
udma1 - 25 MB/s
udma2 - 33.3 MB/s
udma3 - 44.4 MB/s
udma4 - 66.6 MB/s
udma5 - 100 MB/s
udma6 - 133.3 MB/s
Remember that those are burst speeds, you'll never even come close to those numbers unless you're doing burst speed benchmarks (something hdparm doesn't).
If DMA is enabled for that particular disk hdparm should show that udma4 or udma5 is selected. ~25 MB/s in buffered reads looks pretty OK for a 5200 rpm disk, I'm getting ~35 MB/s with an Athlon 1333 + 7200 rpm disk (running in udma4 mode). |
|
Back to top |
|
|
Guest
|
Posted: Wed Apr 17, 2002 8:32 pm Post subject: |
|
|
Thanks for these great tips! My DMA mode was also disabled though my new hd even supports UDMA100! Now my performance greatly improved!
This is definitively something for the installation docs or FAQ of forthcoming Gentoo versions!
BTW: Gentoo rules! |
|
Back to top |
|
|
Ozymandias Tux's lil' helper
Joined: 10 Apr 2002 Posts: 81 Location: Netherlands
|
Posted: Wed Apr 17, 2002 9:20 pm Post subject: |
|
|
oke thank you!
one last thing, mine is in udma2 modes, I don't get higher modes listed, but I assume that udma2 is ata33 ? and udma4 is ata100 ? if I do a hdparm -d1 -X100 is that wise? the manual says this is dangerous.. but I know my drive can do ata100 (hdparm even says that) and my motherboard can do too, so .. is -X100 wise?
thnx greetz Ozy |
|
Back to top |
|
|
Guest
|
Posted: Wed Apr 17, 2002 10:06 pm Post subject: |
|
|
Well ... There is some confusion regarding the ATA-X, UltraATA-XX and UDMA modes ... That is because we're mixing ATA specifications, protocols and DMA modes. The manufacturers didn't wait for a "real" specification so they invented their own versions instead ...
But if we did try to summarize the various modes, we have:
Code: |
ATA Protocol DMA Mode Burst Speed
----------------------------------------------
ATA IDE PIO-0 3.3 - 8.3 MB/s
PIO-1
PIO-2
MDMA-0
ATA-2 Fast ATA PIO-3 11.1 - 13.3 MB/s
(EIDE) MDMA-1
ATA-3 Fast ATA PIO-4 16.6 MB/s
(EIDE) MDMA-2
UDMA-0
ATA-4 UltraATA-33 UDMA-2 33.3 MB/s
ATA-5 UltraATA-66 UDMA-4 66.6 MB/s
ATA-6 UltraATA-100 UDMA-5 100 MB/s
ATA-7 UltraATA-133 UDMA-6 133 MB/s
|
The manufacturers mixed bits from here and there (to impress the consumers - i.e. you and me) so we also have names like UDMA-66 and stuff like that. But if you look at the table above I think you can see what modes there are and their burst speed specification.
Ozy: udma4 is UltraATA-66. udma5 is UltraATA-100.
If you do a hdparm -I /dev/hda (uppercase 'I') you will get a more precise description of what your disk can handle. Compare that to the table above.
And yes, the -X option can be somewhat dangerous - don't do that on a system you've been working on for several days to install and configure |
|
Back to top |
|
|
Ozymandias Tux's lil' helper
Joined: 10 Apr 2002 Posts: 81 Location: Netherlands
|
Posted: Wed Apr 17, 2002 10:13 pm Post subject: |
|
|
thank you for beeing this helpful
so my hd is in udma2 but can do udma5 (ata 100 .. the one I want) how do I get in udma5? hdparm -X100 /dev/hda ? or must I change something in my bios? and what if I mount my disks read only just to try it out? should that be saver ?? and what if I put my bios in read only and then try it could that garantee 0% data loss ? Or should I give my kernel the ide=100 (or whatever it was) to get to udma5? any idea's??
greetz Ozy |
|
Back to top |
|
|
Guest
|
Posted: Wed Apr 17, 2002 10:43 pm Post subject: |
|
|
The hdparm option -X works as follows ...
For PIO modes it's the desired mode plus 8. For PIO mode 2 that would be "-X 10", PIO mode 3 is "-X 11" etc.
For Multiword DMA (mdma) it's the desired mode plus 32. For mdma mode 1 that would be "-X 33", mdma mode 2 is "-X 34" etc.
For UltraDMA (udma) it's the desired mode plus 64. For udma mode 2 that would be "-X 66", udma mode 4 is "-X 68".
The udma modes and their "-X" option is:
udma2 : "-X 66"
udma4 : "-X 68"
udma5 : "-X 69"
udma6 : "-X 70"
It's the pio, mdma and udma mode you add, not the speed specification - look at the table, column "DMA Mode" and you'll see what you should add to the base values 8, 32 and 64 (pio, mdma, udma).
(To reset the disk to it's default mode, use "-X 00")
And yes, mounting the disk read only during the test *should* protect you somewhat - I can't guarantee it, but it's at least better than nothing
I have never managed to get file system corruption while trying various options - even though the disk/system have crashed (many, many times). But I can't say it wont happen ...
Always issue the command "sync" before trying so that disk caches are written to disk and file operations flushed. |
|
Back to top |
|
|
Guest
|
Posted: Wed Apr 17, 2002 10:53 pm Post subject: |
|
|
I forgot, you should of course use the "-X" option together with the "-d 1" option for the udma modes ... Unless it's already operating in DMA mode. To set it to udma5 (UltraATA-100) mode I would ...
hdparm -d 1 -X 69 /dev/hda
Remeber to use the other options too for maximum performance (-c 1 -u 1 -m 16) - read my previous reply about that - include the "NOTE". |
|
Back to top |
|
|
Guest
|
Posted: Wed Apr 17, 2002 10:56 pm Post subject: |
|
|
Ugh, getting a bit tired There is a typo in the text above ...
The sentence:
"... For udma mode 2 that would be "-X 64", udma mode 4 is "-X 68"."
Is incorrect, it should read:
"... For udma mode 2 that would be "-X 66", udma mode 4 is "-X 68"."
Of course ... The list is alright though. |
|
Back to top |
|
|
fghellar Bodhisattva
Joined: 10 Apr 2002 Posts: 856 Location: Porto Alegre, BR
|
Posted: Wed Apr 17, 2002 11:49 pm Post subject: |
|
|
Edited and fixed.
(Sorry for editing your post, but you posted it as a Guest, and I had no means to contact you first. And I think it's safer this way, just in case people don't read your update.) _________________ | www.gentoo.org | www.tldp.org | www.google.com | |
|
Back to top |
|
|
Buchu n00b
Joined: 18 Apr 2002 Posts: 21 Location: Paris
|
Posted: Thu Apr 18, 2002 1:58 am Post subject: |
|
|
Pepoles who have an via chipset can enable in the kernel configuration HTP366 in ATA/IDE/... for user had and i don't need hdparm optimizations ( it doesn't change nothing for me)
sleepiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz |
|
Back to top |
|
|
Malakin Veteran
Joined: 14 Apr 2002 Posts: 1692 Location: Victoria BC Canada
|
Posted: Thu Apr 18, 2002 2:53 am Post subject: |
|
|
For anyone wondering if there's a difference between -X68 and -X69, I'm getting 40.25M/sec -t either way so it's not making any difference for me. As long as you're using -X68 I wouldn't bother trying to set it to a higher speed, unless maybe you're doing raid striping or something that would increase the throughput beyond that of a single drive.
This is on a kt333 and a maxtor 60G 7200, had to edit the kernel source so the south bridge was identified as a 8233 instead of the 8233a that it is since the 8233a is considered unknown in 2.4.19 kernel that emerge is giving me although I see now that according to the patch log on kernel.org it's apparently supported as of 2.4.19-pre5. |
|
Back to top |
|
|
wombat Guest
|
Posted: Thu Apr 18, 2002 6:24 am Post subject: Can't get DMA on |
|
|
This command: hdparm -c 1 -d 1 -k 1 /dev/hdc
Gives me this response:
/dev/hdc:
setting 32-bit I/O support flag to 1
setting using_dma to 1 (on)
HDIO_SET_DMA failed: Operation not permitted
setting keep_settings to 1 (on)
I/O support = 1 (32-bit)
using_dma = 0 (off)
keepsettings = 1 (on)
How can I get my DMA on ? Is it a missing kernel option ? I am only getting 2.1MB/S from my new Deskstar ! |
|
Back to top |
|
|
pr0vidence n00b
Joined: 12 Apr 2002 Posts: 47 Location: Connecticut
|
Posted: Thu Apr 18, 2002 1:13 pm Post subject: Re: Can't get DMA on |
|
|
wombat wrote: | This command: hdparm -c 1 -d 1 -k 1 /dev/hdc
Gives me this response:
/dev/hdc:
setting 32-bit I/O support flag to 1
setting using_dma to 1 (on)
HDIO_SET_DMA failed: Operation not permitted
setting keep_settings to 1 (on)
I/O support = 1 (32-bit)
using_dma = 0 (off)
keepsettings = 1 (on)
How can I get my DMA on ? Is it a missing kernel option ? I am only getting 2.1MB/S from my new Deskstar ! |
I don't know if it has anything to do with it, but I don't tihnk you are supposed to have spaces between the "d" and the "1" so you like should look more like this:
hdparm -c1 -d1 -k1 /dev/hdc
NOT
hdparm -c 1 -d 1 -k 1 /dev/hdc
Try that. |
|
Back to top |
|
|
Guest
|
Posted: Thu Apr 18, 2002 2:05 pm Post subject: |
|
|
The space between the option and it's value doesn't matter, hdparm recognize both formats, even the hdparm author writes it sometimes as "-d 1" and at other times as "-d1". The man page synopsis shows it with spaces.
First: You wrote "/dev/hdc" is the disk *really* at that device id? You're not trying to enable dma on your cdrom, are you?
There are a couple of things that possibly prevents you from enabling DMA on your Deskstar disk.
- The kernel/hdparm has your specific disk on the "black list". A list of disks with known or reported problems.
- Your disk doesn't support DMA ... At least was not detected as a DMA capable drive. Try "hdparm -I /dev/hdc" and you'll get a list of the modes hdparm thinks your drive can handle.
- Chipset problem. Since you wrote "/dev/hdc", perhaps it's located on a HPT or Promise controller?
BTW, regarding -X 68 and -X 69, I don't exactly remember when the kernel and drivers started to support UltraATA-100 (udma5). If it's not supported by this kernel/driver version you will probably not gain anything even if you enable udma5 mode. That is perhaps what's happening, same thing as in Windows |
|
Back to top |
|
|
pr0vidence n00b
Joined: 12 Apr 2002 Posts: 47 Location: Connecticut
|
Posted: Thu Apr 18, 2002 3:11 pm Post subject: |
|
|
Sorry, my mistake. |
|
Back to top |
|
|
Anti n00b
Joined: 18 Apr 2002 Posts: 45
|
Posted: Thu Apr 18, 2002 3:45 pm Post subject: |
|
|
Yay! Good I saw this thread!
Got my HD up from doing 4.5MB/sec to do 35.5MB/sec
So, thanks for the info.
Great forum, btw _________________ stuff is good. |
|
Back to top |
|
|
Guest Guest
|
Posted: Thu Apr 18, 2002 5:28 pm Post subject: w00t |
|
|
Thanks to this thread I've found the source of a problem I've been trying to fix for some time now! I have a 100mbps switched network that was only giving me 33% usage when copying files form my windows machine to a fileserver running linux with 3 drives stripped. For a while I thought it might be the network cabling since they're all old and have been kinked...I checked out this thread and did some tests on my drives. Before tweaks, two of my three were showing reads of 100MB/s and writes between 10 and 11 MB/s. The second drive was down low in 3MB/s which tells me it was the limiting factor! I tweaked it up and it was getting 10-11MB/s also. After doing that, my network shows throughput of around 60Mbps steady and operations between 50 and 75 mbps!! WOOHOO |
|
Back to top |
|
|
Jeevz Bodhisattva
Joined: 15 Apr 2002 Posts: 195 Location: Boston, MA
|
Posted: Sat Apr 20, 2002 12:22 am Post subject: |
|
|
How are you guys breaking the 30 MB/sec mark? I have all those settings. Asus P4t motherboard with a P4 1.5, ATA100 7200 hard drive. I only get 28.96 MB/sec almost all the time. |
|
Back to top |
|
|
squanto Guru
Joined: 20 Apr 2002 Posts: 524 Location: Rochester, NY, USA
|
Posted: Tue Apr 30, 2002 11:28 pm Post subject: |
|
|
"How are you guys breaking the 30 MB/sec mark?"
I only get 28.07 MB/sec from my Maxtor ultra 100 5400 drive on via chipset, but I think that is pretty good for a 5400 drive, I am not sure why you wouldn't get over 30megs/sec.
-Andrew |
|
Back to top |
|
|
|