Ubuntu: disable indexing

If you are a developer the last thing you want running on your system is an indexing daemon, that keeps the cpu busy and eats precious i/o. If you’re like me, you want to get rid of it as soon as you can! Yes, we all know that the thing is “configurable”, but anyway it keeps eating resources and it will also slow down your desktop (if you have one)
So, just go to synaptic (or apt. if you are a command line guy) and remove “tracker” and related dependencies. Be sure to remove also “beagle”, you may have installed in some previous life :)

There Will Be Code

“Remember that code is really the language in which we ultimately express the requirements. We may create languages that are closer to the requirements. We may create tools that help us parse and assemble those requirements into formal structures. But we will never eliminate necessary precision — so there will always be code.”

Robert C. Martin – Clean Code

Software and conventional engineering

“…the analogy to conventional engineering fails because the construction of an oil production platform is materially different from the production of a computer program. The detailed design specification of a program is its code; the actual building of the program is done automatically. One of the goals of almost all programming languages ever developed has been that the code shall be self-documenting. When we look upon it this way, 100% of all programmers do detailed design.”

“Why Programmers Don’t Use Methods And What We Can Do About It”, a column in ObjectEXPERT January 1997 by Trygve Reenskaug

The technology paradox

“…the same technology that simplifies life by providing more functionality … also complicates life by making it hard to learn. This paradox of technology is often used by people as an excuse for poor design…”
Donald A. Norman – The Design of Everyday Things, 1988 (pp. 30-31)

1988… sounds actual? By “technology”, are you thinking, as I’m now doing, about the latest state-of-the-art framework you’ve been using on your last software project? And by “design”, are you thinking about the actual software design of such project?

Think about it.

Don’t judge a book by its cover

Head First Object-Oriented Analysis and Design
This is not a spot. This is a book I’ve been leaving closed because of its cover… what a pity! This is the first book I’ve ever read that actually talks and explain object oriented in an easy and pleasant way. Most experienced programmers will find it not much useful, but for a newbie or an intermediate OO programmer this is a must read.

In case of doubt, just read it :) It will worth the time you’re going to spend. Definitely. And it’s also quite amusing sometimes!

DMRAID on Ubuntu with SATA fakeraid

The problem
Ubuntu (and Debian) doesn’t have support for the SATA RAID (also called FakeRAID since some of the functionality is provided by software) controllers being shipped on recent motherboards. The software to handle FakeRAID arrays in Linux is DMRAID. How do I install such systems?

.
Preliminary Operations
You will need to configure your RAID using the bios utility (Ctrl+M for me on startup) : just select your disks, create the logical unit selecting your desired raid mode (0 or 1 for me), save and boot with a desktop live CD.

Note: in this example I’m using Fujitsu Siemens Primergy RX100 S4 equipped with two 160Gb SATA drives, and I’m creating a RAID0 array, with Ubuntu Linux 7.10 Gutsy Gibbon

.
1st phase – create your partitions

To create your partitions you’ll need that your RAID is reconized from your system. Unfortunately, at the time I’m writing, Ubuntu does not include DMRAID support in its install procedure, so you’ll need to start with a live CD, activate DMRAID support and proceed to partitioning.

  • start your system with an Ubuntu Desktop CD (select your language if needed)
  • open a terminal (CTRL-ALT-F1), set a new root password wih “sudo passwd root”
  • go on with “su – ” (digit your password)
  • edit /etc/apt/sources.list, uncomment universe packages
  • “apt-get update”
  • install dmraid: “apt-get install dmraid”
  • Launch fdisk specifying the shorter device you find under /dev/mapper/dxxx (dxxx is the file device with shorted name, es.: dxxxa28 is the correct one, dxxxa281 the wrong one)
  • create a primary partition of 316GB, the other with the remaining space (we’ll use it for swap)
    • n <enter>
    • p <enter>
    • 1<enter>
    • <enter>
    • +316GB
  • create a primary partition with the remaining space:
    • n <enter>
    • p <enter>
    • 2 <enter>
    • <enter>
    • <enter>
  • change second partition type:
    • t <enter>
    • 2 <enter>
    • 82 <enter>
  • save with “w”, <enter>
  • restart your system with “reboot”

.

2nd phase – installing a minimal ubuntu
To format your partitions you’ll need DMRAID module loaded. So you’ll need to repeat the first six previous steps.

  • format your root partition
    • mkfs -t ext3 /dev/mapper/dxxx1 (select the device ending with 1)
  • prepare a local area for the installation procedure: create a local folder, mount your formatted partition on that folder, bind and mount the necessary stuff
    • mkdir /target
    • mount /dev/mapper/dxxx1 /target
    • mkdir /target/dev
    • mount  – - bind /dev/ /target/dev
    • mkdir /target/proc
    • mount -t proc proc /target/proc
    • mkdir /target/sys
    • mount -t sysfs sys /target/sys
  • proceed installing a minimal ubuntu
    • apt-get install debootstrap
    • debootstrap gutsy /target
  • copy essential files on your partition
    • cp /etc/apt/sources.list /target/etc/apt/
    • cp /etc/resolv.conf /target/etc/
    • cp /etc/hosts /target/etc/
    • cp /etc/network/interfaces /target/etc/network/
  • switch on your new system, re-mount /proc, /sys, /dev
    • mount  – - bind /dev/ /target/dev
    • mount -t proc proc /target/proc
    • mount -t sysfs sys /target/sys
    • chroot /target
  • install a basic ubuntu system
    • apt-get update
    • apt-get install language-pack-en
    • apt-get install ubuntu-standard linux-generic dmraid grub
  • create a user, if you want
    • useradd pippo
    • passwd pippo
    • mkdir /home/pippo
    • chown pippo /home/pippo
  • set root password
    • passwd root

.

3rd phase – boot loader configuration
Yes, you’ll need to configure grub

  • copy grub essential files
    • mkdir /boot/grub
    • cp /usr/lib/grub/i386-pc/stage1 /boot/grub/
    • cp /usr/lib/grub/i386-pc/stage2 /boot/grub/
    • cp /usr/lib/grub/-pc/* /boot/grub/
      This will copy the staging file for the various filesystem in your boot partition. In my example the directory is “/usr/lib/grub/i386-pc/” and the files that are copied are “e2fs_stage1_5″, “jfs_stage1_5″,…
  • configure di grub
    • grub (enters grub interactive shell)
    • device (hd0) /dev/mapper/dxxx (the shorter, so the logical disk, not the partition)
    • root (hd0,0)
    • setup (hd0)
    • quit (exit from grub shell)
    • update-grub (update grub files)
  • configure grub menu
    • edit grub menu.lst: “vi /boot/grub/menu.lst”
    • check groot is pointing to hd0,0 (it should be necessary to uncomment that line)
    • check that savedefault is commented (normally is)
    • modify, inside “kernel” items, the “root” value to “/dev/mapper/dxxx1″ (your root partition)
  • configure static mount under /etc/fstab

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/mapper/ddf1_LogicalDrive_01 / ext3 defaults 0 1
/dev/mapper/ddf1_LogicalDrive_02 none swap sw 0 0

  • reboot :)

Bottom line
Well, you’ve done! Remember that if you mounted a RAID0 device Linux at startup will probe your disks and he’ll wrongly detect a bad partition table: ignore error messages http://osdir.com/ml/linux.ataraid/2006-10/msg00019.html

Little tips:

Links
http://www.ubuntu-in.org/wiki/SATA_RAID_Howto
https://help.ubuntu.com/community/FakeRaidHowto
http://salaros.blogspot.com/2007/07/installare-ubuntu-704-su-raid0-in-dual.html