xgrr.de – the whole not the half

things, thoughts and stuff out of life, daily business and computer science


Linux: Re-Read Partition Tables

You know how it is. Just created a new partition but it is not directly regocnized by the system without a reboot. And rebooting means downtime, going to the data center thus inconvenience. There are a few tricks you can try before having to move your body physicly:

partprobe

Check if the new partition was recognize using dmesg. If that didn’t help try the following:

hdparm -z /dev/sdX

Where /dev/sdX is the device on which you created the new partition.

Areca RAID Discovery in Linux

Short version: Pain in the ass in the beginning. Long version. Areca provides a HTTP proxy and a CLI interface to the the controllers. Unfortunately the Kernel driver which comes with the vanilla Kernel from kernel.org does not include the necessary functions to allow the newest versions of these nice tools to access the controller directly, which is kind of stupid.

However. As my RAID was migrating and I wanted to have the progress (takes some time with 5TB) accessible nicely remote on my browser I searched the Areca FAQ section (which is really good btw) and found an entry which describes the problem and also provides a solution

Only the version 1.71 of the HTTP interface is capable of connecting to the driver provided by the vanilla Kernel. I actually don’t know if they changed something in the driver in the meantime.

You can find the right version of the HTTP interface on the Durch Areca mirror.

Partitions > 2TB with Linux

It took me a while to figure out how to get my new RAID featuring 5x 1TB WD10EADS working as one unified ext4. The problem lies in the partition table. After trying and testing (for which I have absolutely no time as I’m currently writing on my thesis) I found a good reference how to solve this problem.

The standard partition label (or partition table type) “msdos” does not support more than 2TB partitions. The solution is to use the EFI GPT partition table. With Debian the support for this partition needs to be enabled in the Kernel specificly otherwise (which just happend to me after copying ~ 800GB) the partition is not readable or of limited size after reboot.

If you struggle with large disk and partitions check out this straight forward howto on creating the right partition labels and activating support for them in the Kernel.

Lost root Password? Boot without it!

Some time ago I placed a post (see Starten von Linux ohne Passwort) on how to boot without knowing any password of the machine. The post describes how to do it with Lilo. In the mean time I found out that some derivates behave quite different and that Grub more and more becomes standard boot manager (poor Lilo).

I tried it with some derivates and it worked like a charm. Please note that there could be differences between the server and possible available community versions.

For all derivates that operates with Grub counts: As soon you see Grub stop boot process and change the boot parameters according to the following small table:

Derivate			| Option
=============================================
SuSE Linux Enterprise Server 10	| init=/bin/sh
Red Hat Enterprise Linux AS 4.5	| single
Debian GNU/Linux 3		| init=/bin/sh
Debian GNU/Linux 4		| init=/bin/sh

If you hold on to that you should be able to boot directly into a shell. Remount the / partition and change any password you like. There are some tools which try to prevent that from happening but as far as I’ve experienced it nobody deploys them (except for Red Hat but you’re still able to access the shell via the “single” switch)

Let met know if you make other experiences or discover other switches for different derivates.

Sphairon Turbolink IAD

During the day I was curious what is behind the Sphairon Turbolink IAD. On a few forums I saw posts that there is SSH available. On the manufacturers website there is a download section for this device (hidden yeah – but publicly available) where you can download the code used on the device.

It seems that they use a linux (it looks like they have versions for the 2.4 and 2.6 kernel series). I will investigate this further – it has to be possible to open the firmware and have a really cool router :)

UPDATE: One component identified. The Turbolink IAD makes use of uboot – the Universal Boot Loader. This could be a point to start…

A (new) Spam technique?!

When I couldn’t sleep last night I had to think about my new mailserver installation and the load of measurements I’ve undertaken to prevent my customers getting spam or to allow anybody to relay spam through my server. Then I realized that there might be the chance of a new method how good spam-filter techniques could be used as a spam drone.

Get the situation: I’m John the bad spammer and want to deliver my mails to a lot of boxes around the world. I connect to a mailserver and deliver all my mails with a faked envelope. The to address has to contain an mailinglist or something like that which bounces emails for people who are not listed and the return address should be the person where the spam has to go. The mailserver (when configured to comply with RFC) should send the bounce directly to the person who should recieve the spam. This is only working if the spamfilter like spamassassin doesn’t act after the SMTP dialog has finished.

I didn’t try it but it could be exploited at some point. Due to the fact that there are many hosts who doesn’t send bounces anymore (in Germany some of the government servers has bounces off) or has the spamfilter integrated in the smtp dialog which scans the mail while delivering it shouldn’t be a big problem. But it could…

Making Apach2 even faster

When I built my new webserver I had to decide if I gonna use lighttpd or apache2. I wanted to use lighttpd because in fact it is faster than apache2. But then I discovered that it doesn’t support .htaccess files heavily used by my customers. So I had to throw away my flowery plans and use apache2 again. (Not that I’m really sad about it – the configuration was easy beacause I’m using it since… a long time ago :) )

But I figured there has to be something to make the apache2 faster that it is out-of-the-box on a Debian Etch system. I wanted to use mod_fastcgi to link PHP and use mpm-worker for apache2 but due to a lack of time I failed. Later I discovered it was only a matter of permission which prevented this. Due to mod-php5 I couldn’t use mpm-worker but had to use mpm-prefork the slower variant.

With this in mind I thought “lets check the apache2 docs and check if there is something we can do about this”. So I discovered the following directives which can fasten up things a little bit:

BufferedLogs On
EnableSendfile On
HostnameLookups Off

BufferedLogs is an experimental directive which prevents Apache2 to write logs directly to the disk but keeps them in memory and write them in a bunch. This should minimize the write overhead for each access so the access itself is faster.
With EnableSendfile you tell apache2 to use the sendfile method from the Kernel for static files which should prevent apache2 to read the file itself so reducing the readoverhead for static content.
HostnameLookups is off by default on Debian Etch. I don’t know how it is on other distributions. The command prevents apache2 to make an lookup for the ip from the visitor. When your nameserver is slow or no hostname can be resolved this could slow your system down incredibly. (In my expirience 70% all the problems with databases or webserver are DNS problems).

Tuning up VMware Server on Linux

When I finished my VMware Server 1.0.4 installation on Debian Etch with a 2.6.22.9 Kernel and moved all customers to the new server I was very disappointed. The overall performance was very poor on a dual Opetorn system with 2 GB memory and I had no explanation for it. After a little testing I figured that I gave all the available memory to use for the VMs and left almost nothing over for the server itself. When I pushed about 100 MB of memory free for the server itself the performace improved a lot.

But after all. A VMware Server with six running VMs doesn’t fit into 2 GB of memory. Start with three, be certain with four GB of main memory.