Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Linux Software

Linux Tuning Tricks? 71

Milo_Mindbender writes: "Over the weekend I was attempting to improve my CD ripping performance and discovered RedHat 7.2 was running my Ultra/ATA 100 hard drive in a very slow non-DMA mode. After a fair amount of searching for how to fix this, a trivial change (look here) improved drive performance from 3MBs to 38MBs! FSCK on my 40gb partition went from over 5 minutes to under 1! This issue wasn't documented in RedHat's manuals but it effected a number of boxes in our office so I'm betting many other people in the world have the same problem. This made me wonder how many other common Linux tuning snafus there might be that a lot of people are probably missing. Do you know of any?"
This discussion has been archived. No new comments can be posted.

Linux Tuning Tricks?

Comments Filter:
  • by babychess ( 452803 ) on Thursday March 14, 2002 @10:35AM (#3162233)
    On RedHat, you can use ksysv, the init editor, to turn off boot-time system services that are not needed. Candidates are daemons for GPM, USB, SCSI, LPD, APM, which are all enabled by default, and which may not be needed.
    • with redhat (maybe others) you can also run the command "setup" and have a curses-based way to do it. or, you can go into /etc/rc3.d (or whatever runlevel your distro/os normally runs at) and move the S##xxxx scripts to K##xxxx to prevent them from starting. this is the standard way of starting/stopping services on SYSV UNIX, so this holds true for Solaris and others.

      -- aside -- you CAN move them to anything other than S##xxxx, but i normally stick with the standard and use K##xxxx

      • Renaming them to K##xxxx is not necessarily a good idea. Instead of just not telling them to start, you're telling them to Kill off the service if it's running. This will slow down your boot as you try to kill of things that never started.

        I always preferred what my predecessor used of renaming S##xxxx to _S##xxxx. This keeps things clear as to what the system *used* to do.
        • Renaming them to K##xxxx is not necessarily a good idea. Instead of just not telling them to start, you're telling them to Kill off the service if it's running. This will slow down your boot as you try to kill of things that never started.

          true, but if you do this you have to make sure that they dont get started in any other runlevel. (runlevel 2, etc...). this is why i stuck to using the recommended K##xxxx. and if the /etc/init.d scripts are written properly, killing them off isnt much of an issue as there should be pid files in /var/run (or whatever is applicable per your OS).

        • Actually, the K* scripts are run when you leave that runlevel. Your shutdown will be slower as the system is trying to shutdown daemons that aren't running.

          I usually move the scripts from S* to s*. This way I can tell quite easily what I've disabled by hand.

      • you CAN move them to anything other than S##xxxx, but i normally stick with the standard and use K##xxxx

        Actually, in the rc.? directories they are links to the scripts. You could actually delete them to keep them from starting without hurting your system at all (don't try this in the init.d directory). Changing them from S to K (as suggested in a later post) won't prevent the services from being started at run-level 2, unless they are changed in rc.2

        As an aside, if you're running a RedHat based distro, try 'man chkconfig'. It might be useful;)

  • Just a tip. (Score:2, Informative)

    by Anonymous Coward
    s/effected/affected/

    Not trying to be a prick, just trying to let you know for future use! I see this mistake a lot, so...

    "Effect" is a noun, whereas "affect" is a verb.

    When you change something, you affect it. When something you did caused a change, you say the thing you did "had an effect".

    (Effect can also be a verb meaning "to cause", but it's rarely used that way. i.e. "I effected a change.")

    Sorry for the grammar nazi post!
    • I see this one all of the time in posts, in both directions.

      You would expect the hit rate to be at least 50%, but it seems like people almost always use the wrong one.

    • Re:Just a tip. (Score:2, Informative)

      by suwain_2 ( 260792 )
      This is a common mistake, as you said. I think this is one of those words where the meaning keeps evolving... I wouldn't be surprised if, at some point, some dictionary gives in and just says something like "In modern usage, effect and affect are interchangable."

      For now, though, this helfpul tip from Merriam-Webster [m-w.com] is pretty informative (and interesting):

      "The confusion of the verbs affect and effect is not only quite common but has a long history. Effect was used in place of 3affect as early as 1494 and in place of 2affect as early as 1652. If you think you want to use the verb effect but are not certain, check the definitions in this dictionary. The noun affect is sometimes mistakenly used for effect. Except when your topic is psychology, you will seldom need the noun affect." -- From the "effect" entry in Merriam-Webster's online Collegiate Dictionary.

  • by JonBob ( 556956 ) on Thursday March 14, 2002 @10:38AM (#3162243)
    I had to read this story's subject three times before I realized it did not say "Linux Turning Tricks."
  • by hubie ( 108345 ) on Thursday March 14, 2002 @10:41AM (#3162253)
    Linux Journal [linuxjournal.com] has a nice article [linuxjournal.com] on fine-tuning your system (doing things like recompiling the kernel with the best compiler options and optimizations (it also covers hdparam).

    My only gripe with LJ articles is that, even if you put them in print mode, they still run off the end of my paper when I print them.

  • UDMA, etc. (Score:3, Interesting)

    by linuxator ( 529956 ) <fox A&#132;T maarja net> on Thursday March 14, 2002 @10:47AM (#3162290) Homepage
    The truth is, that even on "leading desktop OS" called with a name that reminds sheet of glass between frame, has not UDMA/66 and higher mode turned on by default.

    Problem is, that it breaks compatibility with older hardware... eg. you will put an old harddisk on your comp. and it will "blow up" becouse your fancy OS will think it can take faster transfer speeds... etc.
  • by Mark Wilkinson ( 20656 ) on Thursday March 14, 2002 @11:55AM (#3162619) Homepage
    We recently built a machine around an Abit VP6 with 5 hard disks on it (three on the main IDE controller, 2 on the HighPoint 370 secondary controller). After a few days I noticed we were getting bad blocks on the drives on the HighPoint controller. Running badblocks on the disks gave random errors all over the place.

    I then noticed that the Ethernet card was being given the same IRQ as the IDE controller and got suspicious. I swapped the ether card into different PCI slots until it got its own IRQ, then ran the badblocks check again. Everything ran clean.

    It's also entertaining to use lmbench to test your hardware: it can plot pretty graphs showing how the IO speed changes across the disk surface so you can decide where to put your partitions, if that's important to you.

    Main point though: if at all possible tune your hardware and then test using badblocks, lmbench and such before you put the machine into production (or when you've got a solid backup). As the article says, problems with your disk subsystem can loose lots of information quickly.
  • .. okay I did, in fact my rc.custom startup script does this. This is called from rc.local, which never seems to be called from the init scripts on any of my RH installatinos. So I add it rc.sysconf.

    This way when I upgrade I don't end up with issues like this guy.

    I guess I am supprised as I would have though that this would be something you'd see on Linux.com not slash.

    It is a good idea to make sure that before you go mucking with hdparm that you do so knowing that if you make mistakes you can really screw up your harddrive.

    • Amen to that. I had an old fujitsu hard drive, and I started playing with hdparm one day. Basically I turned on every possible option, including the ones marked in the man page as 'this will probably cause extreme filesystem corruption' and 'what are you, on crack? get the hell away from here!', and it worked great. Performance was simply excellent.

      Overzealous, I recommended these options to friends, who all locked up when they tried them (pinging out from IRC, etc), but I was undaunted. When my old HD started to give up the ghost, I got a new (well, new to me, this was 6 months ago) 2 gig WD for the box, and turned all the options on. Hours later, the entire filesystem was corrupted. After the whole system nosedived, I spent more than two hours hitting 'y' in fsck before I decided 'screw it' and reformatted. Fortunately, it was a clean install anyway.

      Moral of the story: test out your psychotic options before you put any important data on the drive. Other moral: say what you like about fujitsu, but their drives support more hdparm options than any other I've seen, and they don't break when you use them.

      --Dan
      • After the whole system nosedived, I spent more than two hours hitting 'y' in fsck before I decided 'screw it' and reformatted.

        You have heard of the -y switch to e2fsck, right? Not that it saves your file system, but it relieves you of pressing 'y' while learning that you are fscked.

        • 'Unexpected incosistancies were found in the filesystem. Run e2fsck again without the -y or -a flags'

          Or something. I was running e2fsck manually.

          Thanks for the tip either way though. :>

          --Dan
      • Other moral: say what you like about fujitsu, but their drives support more hdparm options than any other I've seen, and they don't break when you use them.

        I know I'd never say anything bad about the drives. I've got two: an old 1G drive, and a 3.4 that's still the boot drive of my machine. Still lightning fast for it's time, and ultra quiet. And it's been thru more abuse than I care to mention, and it's still going. I'd buy more Fujitsu stuff, but didn't they sell to Maxtor?
  • Careful with hdparm! (Score:5, Informative)

    by dead_penguin ( 31325 ) on Thursday March 14, 2002 @02:08PM (#3163337)
    If you are going to be playing with hdparm, take my advice and make a backup first! Some interfaces aren't fully supported by the kernel yet, and trying to run drives off of them in certain modes could break in a bad way. In my experience, this then means massive filesystem corruption and a complete reinstall.

    Of course I'm not saying *don't* play with hdparm; just be sensible and only try it on a system you have backed up and can afford to lose for a little while as you're rebuilding it.
    • by dimator ( 71399 )
      People, don't pretend you're cool and not make backups, thinking that nothing will happen if you go screwing with hdparm. I learned the hard way, and now I'll be digging up all my $HOME directory from cryptically named files in lost+found. It should be a fun night.

      I have only myself to blame.

    • IIRC hdparm is usually not needed for 2.4 serial kernels as dma detection etc. is built into the ide drivers.

      I know that the last view redhat 7.2 installs I have done on relatively modern hardware, and an old PII as well, have picked up the correct dma and 32bit IO modes automagically

  • by tshoppa ( 513863 ) on Thursday March 14, 2002 @02:40PM (#3163506)
    While Redhat is pretty good at making a distribution that boots and installs on a very wide number of machines, it's not so good at making this distribution be high-performance. Many things are set to the safest possible value (like the OP's IDE DMA modes) when a much more reasonable value would work on 99% of the hardware out there.

    Life is made more difficult because there is buggy and/or broken hardware out there. I don't blame Redhat for accomodating this hardware, but by doing so they are making their distribution more complicated and less useful for those "in the know".

    Redhat also, of course, distributes the non-kernel binaries optimized for Intel 80386 CPU's when the vast vast majority of installs are going on Pentium-class or better machines. And it doesn't help any that Redhat is using and distributing a very nonstandard version of GCC; see what the GCC developers say about such branches [gnu.org] and what application developers say about this branch [mplayerhq.hu].

    To actually learn a lot about Linux and all the associated tools that make it work, I highly recommend the Linux From Scratch [linuxfromscratch.org] method: build everything from source! You can optimize the build to your machine and end up with not only better performance, but a vastly superior knowledge of everything that used to be "under the hood".

    • The Red Hat / gcc thing is old news. Just look at the date of that article on gnu.org.
    • GCC 2.96-RH fails with C code in one and only one condition: when it's not ANSI-conformant C. GCC 2.96-RH is much more restrictive than GCC 2.95.

      GCC 2.96-RH is worlds better than 2.95 when it comes to generating C++ code. With GCC 2.96-RH and STLport-4.5.3, I was happy as a clam. GCC 2.95's C++ support was anemic, nonstandards-compliant, and just generally sucked for any sort of very serious usage.

      When I was recompiling tons of applications to work with GCC 2.96-RH, every "compiler error" that I found-- every single one --was the result of a programmer doing something that wasn't ANSI/ISO and made an assumption that "well, since GCC 2.95 didn't complain about this, it's okay." I don't blame GCC 2.96-RH for being more standards-conformant; I blame developers for playing fast and loose with the language spec.
  • PCI Bus speed (Score:2, Informative)

    by optikSmoke ( 264261 )
    Another thing I recently noticed which jumped out at me from my kernel messages during boot: the kernel was assuming a 33Mhz system bus speed for PIO. This was fixed by passing "idebus=66" as a kernel boot parameter. See ide.txt in the kernel documentation sources for more info.
  • by embobo ( 1520 ) on Thursday March 14, 2002 @10:48PM (#3166313) Homepage

    You may try to use Powertweak [sourceforge.net] to alter settings to improve performance.

    Then there is tweaking settings via /proc. I used to have a link to some excellent documentation on it but, alas, I can't seem to find it. You could try reading the various bits of info in the Documentation tree of the Linux source but it is pretty spartan.

  • Funny, the Ultra/100 drive in my Redhat 7.2 box is using DMA by default:

    # /sbin/hdparm -tT /dev/hde
    /dev/hde:
    Timing buffer-cache reads: 128 MB in 0.72 seconds =177.78 MB/sec
    Timing buffered disk reads: 64 MB in 1.82 seconds = 35.16 MB/sec

    # /sbin/hdparm -d /dev/hde
    /dev/hde:
    using_dma = 1 (on)

    I know that I didn't have to do anything special to get it working - I just did a regular install and let it go.


    • > Funny, the Ultra/100 drive in my Redhat 7.2 box is using DMA by default:

      I built a box and it worked fine too... until I changed out the motherboard, and then I had to go discover the stuff the author is talking about. It was very clearly enabled in the BIOS of the new m.b.; it just wasn't automatically picked up by Linux like it had been on the original m.b.

  • Of course there are hundreds, possibly thousands, of little tuning tweaks to make Linux perform better. But practically speaking, this is the main one. The other is shutting down services you don't need.

    In an effort to get a working system on every possible computer, Redhat defaults to no hard drive DMA and everything but the kitchen sink running in the background. Fix these two little things, and you're 99% there.

  • Pretty good resource (Score:2, Informative)

    by Yoda2 ( 522522 )
    Lots of nice little Linux tidbits can be found on The Linux Pimp [thelinuxpimp.com]. Can't think of a site more ontopic for this post. The intro is pretty funny too.
  • At the risk of getting flamed by KDE enthusiasts here, if you are using X windows, I would have to say that you should look into using window managers other than KDE (or even Gnome for that matter). Although KDE and Gnome very pretty, I still prefer to use just plain Enlightenment [enlightenment.org]. If you want to run KDE or Gnome apps (which I still can and do), just install the libraries. I've removed all my window managers from my install and am just running a clean E desktop. My screen is not cluttered with window bars and icons; my apps are accessible through a pop-up menu with a click of the mouse; and best of all, it's still very fast to login to my account/desktop (faster than windows 95)--and this is all on a dinky Cyrix II 333MHz system that has uptimes on the average of 30-40 days before I reboot for a kernel upgrade or some other system setting change.
  • The same mode change fixes "jerky" movement when playing DVDs (for obvious reason). Observed on ogle and BDV-212B, (non-region-locked, firmware) drive.

"If it ain't broke, don't fix it." - Bert Lantz

Working...