SOLVED: Linux software RAID 5 too slow

In this article I am going to tell about my experience with Linux software RAID.
So I had a ASUS P6T motherboard which has Intel ICH10R raid controller, 3x 1 Tb SATA 2 HDDs and Intel Core i7 920 processor. So I wanted to install Fedora 10 on that machine.
After configuring RAID 5 in the BIOS I booted the Fedora 10 installation DVD to start the installation. BUT! Suddenly I saw that Anaconda see 3 separate hard drives instead of 1 RAID device. After some googleing I figured out that my motherboard don’t have real RAID controller. Instead it is fakeraid controller. It is just software raid which software is located in BIOS. So I decided to use linux software raid, because it is definitely better than the from ASUS.
So installed Fedora 10 with linux software RAID 5 with LUKS encryption. After installation machine started to work very slowly. I thought it so because of the encryption, but after some googleing I understood that the encryption can’t slow down the machine that way. The thing was when you newly create RAID 5 array it needs to build the 3rd hard drive and it take a lot of time. It took from me approximately 4 hours to finish that operation on 1 Tb hard drives. You can check the rebuild status at any time invoking one of the following commands:

# cat /proc/mdstat


# mdadm --detail /dev/md0

After rebuild was over and after some tunings (see tuning parameters below) I had ~90 Mb/s write and ~200 Mb/s read.

My tuning parameters was:

echo 32768 > /sys/block/md0/md/stripe_cache_size
blockdev --setra 65536 /dev/md0

, ,


VMWare Workstation 6.5 segfault on Fedora 10 x86_64

VMWare Workdstation 6.5 is causing segmentation fault on Fedora 10 x86_64 when trying to execute it. The message is:

/usr/lib/vmware/bin/ line 231: 13748 Segmentation fault      "$binary" "$@"

To solve the problem you need to do this:

# mv /usr/lib/vmware/modules/binary /usr/lib/vmware/modules/binary.old
# vmware-modconfig --console --install-all

After build is over start VMWare, it should work now.

Taken from



GDM root login in Fedora 10

To enable logging in with root user on fedora 10 system simply edit file /etc/pam.d/gdm and comment out line:

auth required user != root quiet

Thats it :)

No Comments

Fedora 10 mouse pointer problem

I’ve just discovered that when intalling Fedora 10 on some computer causes this problem. Problem start from instalation: there is no pointer for mouse in Anaconda and further in the system. It is a little bit dificult but install system with keaboard only, then when system installed and running do the following steps to fix this issue:

# yum install system-config-display

Open system-config-display and just press “OK” button. It will generate xorg.conf file in /etc/X11.
Then open /etc/X11/xorg.conf and in section “Device” add following two lines

Option     "HWCursor"     "off"
Option     "SWcursor"     "True"

Save file and restart your X server. It have to work now.

, , , , , ,


Traffic shaping under Linux with tc and iptables

My aim was to make traffic shaping in our office. Internet router and development server is the same computer. Local network which consist of workstations has to have 300 kbit internet access and also full 1Gbit access to development server. Development server has to have unlimited access to internet. So we have to shape only the traffic which goes from local network to internet. My local network interface is eth1, internet interface is eth0. Local network is and development server’s IP is
I have read some documentation on tc and iptables and wrote this scripts.

# Delete root qdisc from eth1 in case that we execute this script for the second time
tc qdisc del dev eth1 root
# Create root qdisc
tc qdisc add dev eth1 root handle 1:0 htb default 2
# Create main class with 1 Gbit traffic
tc class add dev eth1 parent 1:0 classid 1:1 htb rate 1024mbit ceil 1024mbit
# Create class for local network with 300 Kbit traffic
tc class add dev eth1 parent 1:1 classid 1:2 htb rate 300kbit ceil 300kbit
# Create class for development server again with 1 Gbit
tc class add dev eth1 parent 1:1 classid 1:3 htb rate 1024mbit ceil 1024mbit
# Adding qdiscs to our tree leaves
tc qdisc add dev eth1 parent 1:2 sfq
tc qdisc add dev eth1 parent 1:3 sfq
# Route packets marked with 0x7 to 1:2 qdisc which is for local network
tc filter add dev eth1 parent 1:0 protocol ip prio 1 handle 7 fw flowid 1:2
# Route packets marked with 0x8 to 1:3 qdisc which is for development server
tc filter add dev eth1 parent 1:0 protocol ip prio 1 handle 8 fw flowid 1:3

And finaly we have to configure iptables to mark packets 0×7 or 0×8 acording to its source and destination

# Create three chains for routing
iptables -t mangle -N traffic_office
iptables -t mangle -N traffic_office_to_server
iptables -t mangle -N traffic_server
# Mark traffic from local network 0x7
iptables -t mangle -A traffic_office -j MARK --set-mark 0x7
# Mark traffic from local network to dev server 0x8
iptables -t mangle -A traffic_office_to_server -j MARK --set-mark 0x8
# Mark traffic from internet to dev server 0x8
iptables -t mangle -A traffic_server -j MARK --set-mark 0x8
# Send traffic to chain traffic_server which comes from server and not going to local network
iptables -t mangle -A POSTROUTING -s -d ! -j traffic_server
# Send traffic to chain traffic_server which comes from somewhere, not from local network and goes to dev server
iptables -t mangle -A POSTROUTING -s ! -d -j traffic_server
# Send traffic to chain traffic_office which comes not from dev server and goes to local network
iptables -t mangle -A POSTROUTING -s ! -d -j traffic_office
# Send traffic to chain traffic_office which comes local network and goes not to dev server
iptables -t mangle -A POSTROUTING -s -d ! -j traffic_office
# Send traffic to chain traffic_office_to_server which comes dev server and goes to local network
iptables -t mangle -A POSTROUTING -s -d -j traffic_office_to_server
# Send traffic to chain traffic_office_to_server which comes local network and goes to dev server
iptables -t mangle -A POSTROUTING -s -d -j traffic_office_to_server

, , , , , ,


Start guide to GPG

Very good video tutorial that will help you to start using the GnuPG

, , ,

No Comments

Red5 installation on Fedora 8

I was trying to install Red5 on Fedora 8 for about 3 days :) . I was using this tutorial, which is called Setting up Red5 on Fedora Core 4, to do that. I was using it because I have previously used this howto and had success. But this time it was awful :)
Just after installing java and ant and exporting path variables I was trying to build Red5, but I was getting a lot of unresolved dependencies and of course build failed. After some googling I understood that just Red5 moved to googlecode and Ivy (dependency manager for java) was trying to find dependencies from old repositories. Just if you download 0.6.3 version of Red5 as mentioned in howto you will find it impossible to compile Red5 :)
I have found the new howto, which is located here, which does not describe howto install java, but does describe howto install latest SVN version of Red5. This time Ivy was searching dependencies on googlecode, and everything worked this time :)
Just I will ask to Red5 to remove old howto (or modify it), because I think there will be many people like me that will spend 3 days on Red5 installation

Good luck

, , ,


Problem with apxs under Fedora 7 x86_64

I was trying to compile mod_openpgp under Fedora 7 x86_64 with command:

apxs -c -Wc,-g -i -l gpgme -l gpg-error -I /usr/include/ mod_openpgp.c

Output was:

cannot open /httpd/build/ No such file or directory at /usr/sbin/apxs line 201.

The problem caused because pkg-config --variable=libdir apr-1 was giving just nothing. It happens because I had installed apr-devel.i386 and httpd-devel.x86_64.
Problem solved by removing i386 apr-devel and installing x86_64 version instead :)

, , , , , ,


Howto move your linux instalation to another hard drive

In this post I will describe how to move your existing linux installation to another hard drive. This maybe useful if you have bought a new computer and you want to keep your linux and not install it from scratch.

So first of all we will need some live cd linux, because we can’t migrate “/” partition when system is running because there are many temporary files (like lock files, pid files) that we don’t need to migrate, otherwise migrated system will not run correctly. So I have chosen Knoppix live cd which you can download from

Now we need to connect both hard drives (old and new) to same computer and boot from Knoppix live cd.
When Knoppix is successfully booted we need to mount both partitions (old and new). Note that we need to mount new partition in writable mode. If you haven’t any created partition yet on new hard drive you can create it by running “qtparted” or “gparted”. Let’s assume that old partition’s name is sda1 and new one is sdb5.

Then we have to open terminal, become root:

$ su

After that we can start copying:

$ cp -av /mount/sda1/* /mount/sdb5/

This may take a while depending on size of your data.

After that boot with your distributive cd, enter “rescue system” mode (in my case I’m using fedora) and simply run:

$ grub-install /dev/sdb5

That’s all. If you will experience some problems don’t hesitate to write me about that :)

No Comments

Efficient usage of CVS in web development

Hello. In this post I am going to introduce how we started using CVS in our work.

First of all I want to tell what our job is. We are developing several big websites with about 20 000 lines of source code. We have 4 dedicated servers with Linux OS. So we need good version control system and ability to make changes to website several times a day. Also it will be good not upload files to server by hand and to have some test place to test unstable code. So I have chosen CVS for this purpose. But the problem is that CVS mostly for application developers who make new releases once a month. So we have to think some scheme of work to deal with CVS in web development.

Here is my solution to this problem. Note that we are working with this scheme for more than month and it seems to fit all our requirements.

So every developer has its own work directory which is located on the development server. Let’s put them in /home. So for example developer Mike has /home/mike and if he developing project which called mysite then it will be located on /home/mike/mysite.

Development server has to have apache and bind configured to allow developers to work and test their work. Every project has to have its own first level domain on developer server. Every user has to have it’s own subdomain on every project. So we have domain http://mysite and Mike can access his copy of mysite at http://mike.mysite . Also we need special domain for testing joined stable version of the site. Let’s call it http://test and we can access current stable version of mysite at http://mysite.test . This files can be located in /home/test .

Our online server has to have 2 CVS copies of the site and one clean copy (without CVS folders) which will serve online site. Let’s put CVS copies in /home/mysite_test and /home/mysite_dev. Online site will be in /home/mysite. If online site’s address is then we have to also have and .

Start of a project

Project manager creates new CVS repository and new module. Let’s call it mysite. Then he tags whole project with tag which called mysite-stable-current.

cvs -q rtag -F -r HEAD mysite-stable-current mysite

Start making new job on project

When developper with name is Mike want to start making new job on the project he creates a new branch with name mysite-mike-job1 from tag mysite-current-stable and starts to work on it.

cvs -q rtag -B -b -F -r mysite-stable-current mysite-mike-job1 mysite

While developing

While developing developer may want to test his work on online server, but without joining it to main branch. In that case he have to commit his current files and execute following command from server in /home/mysite_dev.

cvs -q update -d -r mysite-mike-job1

Then he can test his unstable code on

When job is finished

When developer finishes and tested his job he needs commit all his files. After that project manager have to join the changes of the developer to the main branch. So he executes following commands:

mkdir /tmp/jkh23bhlh234
cd /tmp/jkh23bhlh234
cvs -q checkout -r mysite-mike-job1 mysite
cd mysite
cvs -q update -d -j mysite-stable-current
cvs -q commit -m "Updated with latest stable"
cd /home/manager/mysite
cvs -q update -d -j mysite-mike-job1
cvs -q commit -m "joined mysite-mike-job1"

Then we have to tag this branch as merged

cvs -q rtag -F -r mysite-mike-job1 mysite-mike-job1-merged mysite

To have history of stable versions we have to make additional tag in format mysite-stable-YEAR-MONTH-DAY_HOUR-MINUTE-SECOND

cvs -q rtag -r HEAD mysite-stable-108-7-1_6-40-21 mysite

Then we tag our joined version as mysite-stable-current

cvs -q rtag -F -r HEAD mysite-stable-current mysite

Uploading to online server

To upload last stable version to server we need to execute following command in online server’s /home/mysite_test directory

cvs -q update -d -r mysite-stable-current

Then we can make final test of the site on before putting it online. When we finished testing and code is ready to become online we just need to execute following command to copy site from test to online:

/bin/cp -aT /home/mysite_test /home/mysite
find /home/mysite -name CVS -prune -exec rm -rf {} \\;
find /home/mysite -name .cvsignore -prune -exec rm -rf {} \\;

That’s all.

I have wrote bunch of scripts in Perl to automate the process I have recently described. This project is called Web-CVS-Tools. You just need suexec to execute these scripts with privileges of the right user according to your system configuration.

You can download latest version of Web-CVS-Tools from here

Let me explain the purpose of each file in the Web-CVS-Tools. Let’s start from dev_server directory – Global configuration for developers work script. There is defined list of the project and list of the developers. – Main script for developers. It must NOT be called directly, it must be included by the dev_username/ scripts.
dev_username/ – Configuration for each developer.
dev_username/ – Script that developer should call to get his work interface.
manager/ – Script for project manager to merge developer’s work to main branch.

Now let’s look on online_server directory – Configuration for online server. There is array of sites where you must specify the directories of the dev, test main sites. Also there is array of developers and of course address of the CVSROOT. – Main script for uploading last stable version. Must be called directly.

That’s all.

If you have any questions, please do not hesitate to write me :)

For learning CVS I will advice to buy this book: [amazon-product]0596527039[/amazon-product]