Archive for the ‘linux’ Category

I need to share my cdrom over the internet, so this is what I did.
I’m using windows7 for the drive (don’t worry, I’m sharing a Centos CD for a remote install).

The quick steps are:

1. Turn off windows firewall.
2. Share the drive
3. Forward ports 135-139, 445 from your router to the machine (tcp and udp).
4. Access the drive as //ip.address.whatever/cdrom

1. Turn off the firewall

Start -> Control Panel -> System and Security -> Windows Firewall.

Then on left, click: Turn Windows Firewall on or off.  And I turned it off for public and home, then click ok. (don’t forget to turn it back on later).

2. Share the drive.
I insert the CentOS 5.4 64 bit CD into the drive.

Hit Windows-E, then right click on the CDROM (D:)

Share with -> Advanced Sharing…

Click Advanced Sharing

Check “Share this folder”

Change Share name to cdrom (or whatever, you don’t need to change it).

click permissions.  Now check that only “Read” is “Allow” for “Everyone”.

Now the share is available is \\my.ip.address\cdrom

Also note that running this over Samba worked even easier, and I recommend doing that instead of sharing from a windows box.

If you are doing a remote CentOS install, you (most probably) should use the network install. That way the remote machine can use a local mirror to get all the RPM’s, rather than going back to your CD to get it. It was an interesting exercise to install CentOS on a machine in the UK, when I’m sitting here in Brisbane, Australia.

Well, the short answer is no. The long answer is yes, but it’s a pain.

I had a fairly basic setup with 32bit Centos 5.4, inserted the 64bit and went through the “upgrade” procedure. The whole thing took about 5 minutes, and it rebooted just fine (I had to select the 2.6.16-164.el5 option from grub (not the old PAE ones I was using)). but the first command:

yum install

failed with the following error:

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

/usr/lib/python2.4/site-packages/rpm/_rpmmodule.so: wrong ELF class: ELFCLASS32

Please install a package which provides this module, or
verify that the module is installed correctly.

It’s possible that the above module doesn’t match the
current version of Python, which is:
2.4.3 (#1, Sep 3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq

 

Then I noted that hpssd had failed on startup for a similar reason.
“uname -a” presents a promising answer:

-bash-3.2$ uname -a
Linux libero 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
-bash-3.2$

So I think the problem is just with python. After a bit more bashing, there is certainly something wrong because when I try to enforce a install, I get a wrong architecture warning:

[root@libero CentOS]# rpm -ivh ./rpm-4.4.2.3-18.el5.x86_64.rpm ./rpm-libs-4.4.2.3-18.el5.x86_64.rpm ./rpm-python-4.4.2.3-18.el5.x86_64.rpm   ./perl-5.8.8-27.el5.x86_64.rpm ./sqlite-3.3.6-5.x86_64.rpm ./elfutils-libelf-0.137-3.el5.x86_64.rpm --force
Preparing...                ########################################### [100%]
package elfutils-libelf-0.137-3.el5.x86_64 is intended for a x86_64 architecture
package sqlite-3.3.6-5.x86_64 is intended for a x86_64 architecture
package perl-5.8.8-27.el5.x86_64 is intended for a x86_64 architecture
package rpm-libs-4.4.2.3-18.el5.x86_64 is intended for a x86_64 architecture
package rpm-4.4.2.3-18.el5.x86_64 is intended for a x86_64 architecture
package rpm-python-4.4.2.3-18.el5.x86_64 is intended for a x86_64 architecture

I’d be interested to hear in your experience, I know it’s possible thanks to the following link:

[root@libero CentOS]# rpm --eval '%{_arch}'
i386
[root@libero CentOS]#

okay, lets see if we can fix that:

[root@libero CentOS]# rpm -e rpm.i386 rpm-python
error: Failed dependencies:
rpm = 4.4.2.3-18.el5 is needed by (installed) rpm-libs-4.4.2.3-18.el5.i386
rpm is needed by (installed) man-1.6d-1.1.i386
rpm >= 0:4.4.2 is needed by (installed) yum-3.2.22-20.el5.centos.noarch
rpm is needed by (installed) qt4-4.2.1-1.i386
/bin/rpm is needed by (installed) policycoreutils-1.33.12-14.6.el5.i386
rpm-python is needed by (installed) system-config-users-1.2.51-4.el5.noarch
rpm-python is needed by (installed) yum-3.2.22-20.el5.centos.noarch
rpm-python is needed by (installed) system-config-network-tui-1.3.99.18-1.el5.noarch
[root@libero CentOS]# rpm --nodeps -e rpm.i386 rpm-python
[root@libero CentOS]# rpm -ivh ./rpm-4.4.2.3-18.el5.x86_64.rpm
bash: /bin/rpm: No such file or directory
[root@libero CentOS]#

ha ha ha .. no surprise there. I tried just upgrading again, and that didn’t work. So I booted into rescue mode (put in cd, type “linux rescue” at the boot: prompt.
I mounted the drive, copied the runtime to the hard drive, and then copied a number of items back into their appropriate places

mkdir -p /mnt/sysimage/media/cdrom
mount /dev/scd0 /mnt/sysimage/media/cdrom
rsync -a /mnt/runtime /mnt/sysimage/runtime
chroot /mnt/sysimage
cp /runtime/usr/bin/rpm /usr/bin
cp /runtime/usr/lib64/librpm* /usr/lib64
cp /runtime/usr/lib64/libsqlite* /usr/lib64
cp /runtime/usr/lib64/libelf* /usr/lib64

At this point I rebooted.

# as root
mount /dev/csd0 /media/cdrom
cp -r /runtime/usr/lib/rpm /usr/lib/
/runtime/usr/bin/rpm --rebuilddb
#edit /etc/rpm/platform to be x86_64-redhat-linux
[root@libero cdrom]# cd /media/cdrom/CentOS/
[root@libero CentOS]# /runtime/usr/bin/rpm -ivh ./rpm-4.4.2.3-18.el5.x86_64.rpm  rpm-libs-4.4.2.3-18.el5.x86_64.rpm elfutils-libelf-0.137-3.el5.x86_64.rpm  ./sqlite-3.3.6-5.x86_64.rpm
Preparing...                ########################################### [100%]
1:sqlite                 ########################################### [ 25%]
2:elfutils-libelf        ########################################### [ 50%]
3:rpm-libs               ########################################### [ 75%]
4:rpm                    ########################################### [100%]
[root@libero CentOS]#

I thought it prudent to rebuild the rpm database again

[root@libero CentOS]# rpm --rebuilddb
[root@libero CentOS]#

I change the rpm output to show the architecture…

[root@libero CentOS]# cat /etc/rpm/macros
%_query_all_fmt      %%{name}-%%{version}-%%{release}.%%{arch}
%_query_fmt      %%{name}-%%{version}-%%{release}.%%{arch}

okay .. lets see how we go:

[root@libero CentOS]# yum update
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

No module named rpm

Please install a package which provides this module, or
verify that the module is installed correctly.

It’s possible that the above module doesn’t match the
current version of Python, which is:
2.4.3 (#1, Sep 3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq

[root@libero CentOS]# rpm -qa | grep python
gnome-python2-canvas-2.16.0-1.fc6.i386
python-numeric-23.7-2.2.2.i386
python-2.4.3-27.el5.i386
gnome-python2-gnomeprint-2.16.0-3.el5.i386
gnome-python2-libegg-2.14.2-6.el5.i386
gnome-python2-bonobo-2.16.0-1.fc6.i386
gnome-python2-gconf-2.16.0-1.fc6.i386
gnome-python2-gnomevfs-2.16.0-1.fc6.i386
python-elementtree-1.2.6-5.i386
gnome-python2-desktop-2.16.0-3.el5.i386
gnome-python2-extras-2.14.2-6.el5.i386
libxml2-python-2.6.26-2.1.2.8.i386
python-sqlite-1.1.7-1.2.1.i386
python-2.4.3-27.el5.x86_64
notify-python-0.1.0-3.fc6.i386
python-ldap-2.2.0-2.1.i386
libselinux-python-1.33.4-5.5.el5.i386
python-urlgrabber-3.1.0-5.el5.noarch
gnome-python2-applet-2.16.0-3.el5.i386
gnome-python2-gtksourceview-2.16.0-3.el5.i386
gnome-python2-2.16.0-1.fc6.i386
audit-libs-python-1.7.13-2.el5.i386
python-iniparse-0.2.3-4.el5.noarch
gamin-python-0.1.7-8.el5.i386
dbus-python-0.70-9.el5_4.i386

Certainly at this point, I’m running x86 (at least the rpm and kernel are).

rpm --erase rpm-libs-4.4.2.3-18.el5.i386
[root@libero CentOS]# yum install gcc
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

No module named rpm

Please install a package which provides this module, or
verify that the module is installed correctly.

It’s possible that the above module doesn’t match the
current version of Python, which is:
2.4.3 (#1, Sep 3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq

[root@libero CentOS]# yum install gcc
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

No module named rpm

Please install a package which provides this module, or
verify that the module is installed correctly.

It’s possible that the above module doesn’t match the
current version of Python, which is:
2.4.3 (#1, Sep 3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq

And so I attempt to fix it…

[root@libero CentOS]# rpm -ivh ./rpm-python-4.4.2.3-18.el5.x86_64.rpm
Preparing… ########################################### [100%]
1:rpm-python ########################################### [100%]
[root@libero CentOS]#
[root@libero CentOS]# rpm –erase expat –nodeps
[root@libero CentOS]# rpm -ivh ./python-elementtree-1.2.6-5.x86_64.rpm ./python-elementtree-1.2.6-5.x86_64.rpm python-ldap-2.2.0-2.1.x86_64.rpm python-numeric-23.7-2.2.2.x86_64.rpm python-sqlite-1.1.7-1.2.1.x86_64.rpm ./expat-1.95.8-8.2.1.x86_64.rpm
Preparing… ########################################### [100%]
1:expat ########################################### [ 17%]
2:python-elementtree ########################################### [ 33%]
3:python-elementtree ########################################### [ 50%]
4:python-ldap ########################################### [ 67%]
5:python-numeric ########################################### [ 83%]
6:python-sqlite ########################################### [100%]
[root@libero CentOS]# rpm –erase python-2.4.3-27.el5.i386 python-elementtree-1.2.6-5.i386 python-ldap-2.2.0-2.1.i386 python-numeric-23.7-2.2.2.i386 python-sqlite-1.1.7-1.2.1.i386
error: Failed dependencies:
libpython2.4.so.1.0 is needed by (installed) gnome-python2-gnomevfs-2.16.0-1.fc6.i386
libpython2.4.so.1.0 is needed by (installed) rhythmbox-0.11.6-4.el5.i386
libpython2.4.so.1.0 is needed by (installed) libsemanage-1.9.1-4.4.el5.i386
[root@libero CentOS]# rpm –erase python-2.4.3-27.el5.i386 python-elementtree-1.2.6-5.i386 python-ldap-2.2.0-2.1.i386 python-numeric-23.7-2.2.2.i386 python-sqlite-1.1.7-1.2.1.i386 –nodeps
[root@libero CentOS]# rpm -ivh ./sqlite-devel-3.3.6-5.x86_64.rpm
Preparing… ########################################### [100%]
1:sqlite-devel ########################################### [100%]
[root@libero CentOS]# rpm -ivh ./yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm ./libxml2-2.6.26-2.1.2.8.x86_64.rpm
Preparing… ########################################### [100%]
1:libxml2 ########################################### [ 50%]
2:yum-metadata-parser ########################################### [100%]
[root@libero CentOS]# yum update

 

yay .. finally 🙂

I was getting a lot of errors like this:

-bash-3.2$ yum update
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

/usr/lib/python2.4/site-packages/_sqlitecache.so: wrong ELF class: ELFCLASS32

Please install a package which provides this module, or
verify that the module is installed correctly.

It’s possible that the above module doesn’t match the
current version of Python, which is:
2.4.3 (#1, Sep 3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq

-bash-3.2$

For me, that problem was related to some of the yum and python files not being upgraded to 64bit. So I spent a fair bit of time dorking around and upgrading some x86_64 from the cdrom and then deleting (sometimes –nodeps) the i386/i686 ones.

So now the question is, would I recommend this? No! But if you are in a bind, and spending a day or two to sort out the problems is less painful than a fresh install, then it looks like it’ll work to me.

But, after all that, I’m off to reinstall (but it was a fun exercise).

So if you are installing 5.4 somewhere, you might want to wait a few days and get 5.5.
It seems that the 5.5 iso doesn’t fit on a normal DVD, so it’s being split into two!

adjust to matched your jre install:

mkdir -p ~/.mozilla/plugins
cd ~/.mozilla/plugins
ln -s /usr/java
ln -s /usr/java/jre1.6.0_18/lib/amd64/libnpjp2.so

and then restart firefox.

DKIM is used to ensure that mail that says it comes from my domains actually does. You do this by adding an entry to your DNS server (with your public key in it), and then outgoing email is signed (with your private key) using a mail filter (aka milter). I’m using CentOS 5.4 64bit and sendmail.

First a few dependencies:

sudo yum install openssl openssl-devel sendmail sendmail-cf sendmail-devel

Step 1. Install the DKIM milter

Download dkim-milter from sourceforge http://sourceforge.net/projects/dkim-milter/

mkdir ~/dkim
cd ~/dkim
wget http://downloads.sourceforge.net/project/dkim-milter/DKIM%20Milter/2.8.3/dkim-milter-2.8.3.tar.gz?use_mirror=transact
tar xf dkim-milter-2.8.3.tar.gz
cd dkim-milter-2.8.3
cp site.config.m4.dist devtools/Site/site.config.m4
sh Build
sudo sh Build install

Step 2. Generate the private key

cd ~/dkim
openssl genrsa -out rsa.private 1024
openssl rsa -in rsa.private -out rsa.public -pubout -outform PEM
mkdir /var/db/dkim
mv rsa.private /var/db/dkim/mail.key.pem

Step 3. Create the DNS entry.

3a. Add the entry for the public key

I’m using tinydns (actually VDNS but same thing).
You need a TXT entry for the domain mail._domainkey.example.com that looks something like:

k=rsa; p=MIGfMA0…AQAB

I used a tool at: http://www.anders.com/projects/sysadmin/djbdnsRecordBuilder/

to make my entry (for tinydns)

:mail._domainkey.example.com:16:\341k=rsa;\040p=AMIGfMA0GCS...AQABS:86400

(where p= is your public key (rsa.public), and the “mail” in mail._domainkey… matches the mail in mail.key.pem in the instructions in Step 2)

In bind it would look something like this:
mail._domainkey.example.com. IN TXT “k=rsa; p=AMIGfMA0GCS…AQABS”

Step 3b. Set up the signing practice (ADSP)

Add a TXT record to the domain _adsp._domainkey.example.com, to indicate how the emails will be sent. There are three options. dkim={unknown|all|discardable}

unknown Means that the email from this domain might be signed. (could be some/all or none of the emails). This is useful if you send email from home via your ISP.

all Means that all email will be signed.

discardable Means all email will be signed, and if the email is received without it, the recipient should discard it.

I’m going for dkim=all, so my DNS entry is:

'_adsp._domainkey.example.com:dkim=all:86400

Step 4. Setup the mail filter (milter)

sudo adduser -r dkim -s /bin/false
echo > /etc/dkim.conf '
Canonicalization simple
Domain example.com
KeyFile /var/db/dkim/mail.key.pem
MTA MSA
Selector mail
SignatureAlgorithm rsa-sha256
Socket inet:8891@localhost
Syslog Yes
Userid dkim
'

#start the filter:
/usr/sbin/dkim-filter -x /etc/dkim.conf
#add the above line to /etc/rc.d/rc.local
echo '/usr/sbin/dkim-filter -x /etc/dkim.conf' >> /etc/rc.d/rc.local

edit /etc/mail/sendmail.mc and add the following line:

INPUT_MAIL_FILTER(`dkim-filter', `S=inet:8891@localhost')

And then rebuild/restart sendmail

cd /etc/mail
make
/etc/rc.d/init.d/sendmail restart

Step 5. Testing

Send an email to your gmail account, and then view the headers, google will tell you if you got it right, or check out the link at elandsys.com, they have an autoresponder.

Links:

yum install wireshark

First check the arp packets, type tshark -q -z “io,stat,1,arp”, then wait 10 seconds and hit Ctrl-C. Wireshark replaces ethereal.

[root@au1 ~]# tshark -q -z "io,stat,1,arp"
'Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
781 packets captured

===================================================================
IO Statistics
Interval: 1.000 secs
Column #0: arp
|   Column #0
Time            |frames|  bytes
000.000-001.000       1        60
001.000-002.000       2       120
002.000-003.000       2       120
003.000-004.000       1        60
004.000-005.000       0         0
005.000-006.000       2       120
===================================================================

Now run the same thing looking at everything else:

[root@au1 ~]# tshark -q -z "io,stat,1,not arp"
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
624 packets captured

===================================================================
IO Statistics
Interval: 1.000 secs
Column #0: not arp
|   Column #0
Time            |frames|  bytes
000.000-001.000     112     10080
001.000-002.000      97      8694
002.000-003.000     111      9960
003.000-004.000     131     11754
004.000-005.000     114     10188
005.000-006.000      50      4500
===================================================================

and you can see that this is not the case right now. Recently we had a faulty device on the network that was absolutely hammering the local network (I was getting 800k/sec of ARP, and 1.2M/s of total traffic).

The usual way to determine if this is the case is to check the bandwidth on your managed switch, or the stats from your firewall, if you are unlucky then you won’t have this information.  In our case the network was unusable and we had an un-managed switch. So the quick way to determine the problem machine is to unplug the machines one at a time until the problem goes away. (or unplug them all and add them back in slowly).  YMMV.

Fairly straight forward

yum install dhcp
chkconfig dhcpd on
Create /etc/dhcpd.conf from samples
/etc/rc.d/init.d/dhcpd on
/sbin/iptables -A INPUT -i eth0 -p tcp --dport 53 -j ACCEPT
/sbin/iptables -A INPUT -i eth0 -p udp --dport 53 -j ACCEPT

The example below allocates in the range 192.168.0.129 – 192.168.0.254

open up the ports on your machine (careful to only open it up on the internal side if the machine is dual facing).
You could use system-config-securitylevel and add port 53 for TCP and UDP. If you are having problems getting an IP address, check that it’s eth0 (and not say eth1), and if that fails, briefly turn off the firewall while testing.

/etc/dhcpd.conf: you’ll need to edit this to put in the address of your gateway (router), and the ip addresses of your dns servers, and add in any fixed ip address computers at the bottom.

ddns-update-style none;
ddns-updates off;
option T150 code 150 = string;
deny client-updates;
one-lease-per-client false;
allow bootp;
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#

ddns-update-style interim;
ignore client-updates;

subnet 192.168.0.0 netmask 255.255.255.0 {

# — default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;

option nis-domain “mydomain.example.com”;
option domain-name “mydomain.example.com”;

#enter IP addresses of your dns servers (from /etc/resolv.conf)
option domain-name-servers changeme.dns.server.ip, xx.yy,zz.aa;

#option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# — Selects point-to-point node (default is hybrid). Don’t change this unless
# — you understand Netbios very well
# option netbios-node-type 2;

range dynamic-bootp 192.168.0.129 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;

host MYMACHINE {
fixed-address 192.168.0.66;
hardware ethernet 00:26:44:72:e9:15;
}
}

Lucky me, I need to upgrade yet another machine, and it’s my email server. LVM (which I am not a big fan), takes all of the drive by default, and so now I want to resize the volume to be much smaller, then install the new operating system on the same drive (in some of the free space).

Quick Answer:
1. boot rescue cd, don’t mount drives
2. run:

lvm vgchange -a y
e2fsck -f /dev/VolGroup00/LogVol00
resize2fs -f /dev/VolGroup00/LogVol00 100G
lvm lvreduce -L100G /dev/VolGroup00/LogVol00

More Detail:
First I looked to see how much space I’m using.

[root@au1 c]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00 297673144  49140752 233167480  18% /
/dev/sda1               101086     61896     33971  65% /boot
tmpfs                  3109444         0   3109444   0% /dev/shm

so around 50G, kid of a shame because I normally allocate 50G for the installed OS. No worries, I decide to go with 100G. (It’s a 250G drive I think) – hmm… TODO: check it’s not a 300G or 500G drive. Damn, I think it’s 500G…

Insert rescue CD into drive (eg the normal install disk (CentOS 5.4 64bit)).
At the prompt type: linux rescue
and then “Skip” the mounting of the drives.

lvm vgchange -a y
e2fsck -f /dev/VolGroup00/LogVol00
resize2fs -p -f /dev/VolGroup00/LogVol00 100G
lvm lvreduce -L100G /dev/VolGroup00/LogVol00

e2fsck and resize2fs will probably take a long time. For me e2fsck was probably around 5 minutes. resize2fs is certainly longer than that and I won’t know how long as I forgot to add in the -p and I’m about to head out for lunch (Happy Birthday Paul!).

If the Logical volume can be unmounted, then you can do these things without the rescue cd.

after reboot:
[root@au1 c]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00 101573920 49124416 48255200 51% /
/dev/sda1 101086 61896 33971 65% /boot
tmpfs 3109444 0 3109444 0% /dev/shm

I recently upgraded a machine to 64bit CentOS, and now the drives are running crazy slow. hdparm -t /dev/hda showed result like this:

Timing buffered disk reads:   14 MB in  3.18 seconds =   4.40 MB/sec
Timing buffered disk reads:   12 MB in  3.23 seconds =   3.72 MB/sec

And that was on a striped drive! (very slow, should be ~100MB/sec for 1 drive, ~180MB/sec for 2 drive stripe).

I had a similar problem with an SSD, and thought it odd that the drives appeared as /dev/hd?? instead of /dev/sd??. The solution is not to probe the IDE interfaces and you do this by adding ide0=noprobe ide1=noprobe to the kernel params. So now my entry in /etc/grub.conf looks like:

title CentOS (2.6.18-164.11.1.el5) No Probe
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-164.11.1.el5 ro root=LABEL=/ ide0=noprobe ide1=noprobe
initrd /boot/initrd-2.6.18-164.11.1.el5.img

When making such a change, check your /etc/fstab to make sure that it’s not going to load /dev/hd?? since now the drives will change to /dev/sd??. And possibly they might get renumbered (probably thanks to the CD drive). So mine went from /dev/hda -> /dev/sda and /dev/hdc -> /dev/sdb

An earlier post will show that I setup a raid using /dev/hda3 and /dev/hdc1, so I recreated the strip with:

mdadm --stop /dev/md0
mdadm -A /dev/md0 /dev/sda3 /dev/sdb1
#add entry back into /etc/fstab
mount /dev/md0
echo 'DEVICES /dev/hda3 /dev/hdc1 /dev/sda3 /dev/sdb1'  > /etc/mdadm.conf
mdadm --detail --scan >> /etc/mdadm.conf

reboot to test (consider commenting out /dev/md0 in /etc/fstab first).

so after all is fixed up hdparm shows much much better results.

hdparm -t /dev/sda

Timing buffered disk reads:  320 MB in  3.01 seconds = 106.16 MB/sec
Timing buffered disk reads:  320 MB in  3.00 seconds = 106.50 MB/sec

htparm -t /dev/md0

Timing buffered disk reads:  572 MB in  3.00 seconds = 190.41 MB/sec
Timing buffered disk reads:  592 MB in  3.01 seconds = 196.91 MB/sec

Certainly that is acceptable!

mdadm is a pain, since it doesn’t record the raid settings automatically, after you set everything up, you have to remember to save the mdadm.conf file. What a pain. Anyway, I forgot to do that, and on reboot, it hung my machine saying /dev/md0 was hosed.

So here is how I recovered it.

originally, my stripe was created with:

mdadm -C /dev/md0 --level=raid0 --raid-devices=2 /dev/hda3 /dev/hdc1

and so I was able to recreate the stripe using:

mdadm -A /dev/md0 /dev/hda3 /dev/hdc1

and then mount it with:

mount /dev/md0 /www -t ext3

so then I saved the /etc/mdadm.conf file with:

echo 'DEVICES /dev/hda3 /dev/hdc1' > /etc/mdadm.conf
mdadm --detail --scan >> /etc/mdadm.conf

So before adding it back into my /etc/fstab, I reboot, and check that I can mount it

mount /dev/md0 /www -t ext3

and if that works (it did), I add back into /etc/fstab

/dev/md0  /www   ext3   defaults   1 2

and reboot again.