Slashdot Mirror


Linux Tuning Tricks?

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?"

32 of 71 comments (clear)

  1. disable system services on startup by babychess · · Score: 3, Informative

    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.

    1. Re:disable system services on startup by eufaula · · Score: 3, Informative
      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

    2. Re:disable system services on startup by Diamon · · Score: 2, Informative

      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.

    3. Re:disable system services on startup by briany · · Score: 2, Informative
      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.

    4. Re:disable system services on startup by jsprat · · Score: 2
      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;)

  2. Just a tip. by Anonymous Coward · · Score: 2, Informative

    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!

    1. Re:Just a tip. by suwain_2 · · Score: 2, Informative
      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 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.

      --
      ________________________________________________
      suwain_2 :: quality slashdot p
  3. Prostitute Penguin by JonBob · · Score: 4, Funny

    I had to read this story's subject three times before I realized it did not say "Linux Turning Tricks."

    1. Re:Prostitute Penguin by EnVisiCrypt · · Score: 3, Funny

      I thought the same thing when I read the headline.

      > "Linux Turning Tricks."

      I could make a joke about open "sores", but I won't.

      --


      *everything* is Orwellian to cats.
  4. A very nice, recent article ... by hubie · · Score: 5, Interesting
    Linux Journal has a nice article 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.

    1. Re:A very nice, recent article ... by dubl-u · · Score: 3, Funny

      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.

      So I just looked up this "paper" thing on Google, and it sounds really cool, kinda like a flat-panel display with a built-in battery. But how do you slice the trees so thin?

  5. UDMA, etc. by linuxator · · Score: 3, Interesting

    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.

    --
    * Origin: XBase BBS (2:490/4100) Well the good old days may not return and rocks might melt and sea may burn.
    1. Re:UDMA, etc. by Tuzanor · · Score: 2

      Reg hack'll do it on a win2k/xp box: Reg Hack

  6. Check for interrupt clashes, and test by Mark+Wilkinson · · Score: 5, Insightful

    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.

  7. wow.. I never knew that.. by josepha48 · · Score: 2
    .. 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.

    --

    Only 'flamers' flame!

    1. Re:wow.. I never knew that.. by Sentry21 · · Score: 3, Interesting

      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

    2. Re:wow.. I never knew that.. by Peale · · Score: 2

      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?

  8. Careful with hdparm! by dead_penguin · · Score: 5, Informative

    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.

    --

    It's only software!
    1. Re:Careful with hdparm! by dimator · · Score: 3, Interesting

      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.

      --
      python -c "x='python -c %sx=%s; print x%%(chr(34),repr(x),chr(34))%s'; print x%(chr(34),repr(x),chr(34))"
  9. Distributing software but not knowledge = problem by tshoppa · · Score: 4, Insightful
    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 and what application developers say about this branch.

    To actually learn a lot about Linux and all the associated tools that make it work, I highly recommend the Linux From Scratch 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".

  10. Re:Lame Grammer Post by The+AtomicPunk · · Score: 2, Funny

    Spelling grammar correctly would help your case. :)

  11. PCI Bus speed by optikSmoke · · Score: 2, Informative

    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.

    1. Re:PCI Bus speed by Gothmolly · · Score: 3, Informative

      Your PCI bus speed IS 33MHz, unless you are overclocking or running a new, rare, high-end box.

      --
      I want to delete my account but Slashdot doesn't allow it.
    2. Re:PCI Bus speed by SuiteSisterMary · · Score: 2

      Or pretty much any server with 66 megahertz PCI slots.

      --
      Vintage computer games and RPG books available. Email me if you're interested.
  12. May want to learn about 2.96 before you bash it. by rjh · · Score: 2

    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.

  13. Mod this up! Everybody gets this wrong! by andaru · · Score: 2
    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.

    --

    Why is Grand Theft Auto a much more serious crime than Reckless Driving?

  14. Powertweak and /proc twiddling by embobo · · Score: 4, Informative

    You may try to use Powertweak 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.

  15. "Tabilize".... Or just use plain text. by Bob_Robertson · · Score: 3, Insightful

    I agree that wide tables are annoying, but HTML viewers (and printers) nicely re-wrap plain text to fit.

    Sooooo much easier than tables is just to use preformatted text.

    Just a side comment from someone who has always written his web page in vi.

    Bob-

    --
    The Ludwig von Mises Institute. The reasoning individuals economics
  16. Re:mine works by Black+Parrot · · Score: 2


    > 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.

    --
    Sheesh, evil *and* a jerk. -- Jade
  17. Practically speaking... by aquarian · · Score: 2

    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.

  18. Pretty good resource by Yoda2 · · Score: 2, Informative

    Lots of nice little Linux tidbits can be found on The Linux Pimp. Can't think of a site more ontopic for this post. The intro is pretty funny too.

  19. Same for DVDs by Alex+Belits · · Score: 2

    The same mode change fixes "jerky" movement when playing DVDs (for obvious reason). Observed on ogle and BDV-212B, (non-region-locked, firmware) drive.

    --
    Contrary to the popular belief, there indeed is no God.