Archive for March, 2010

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.

I wanted to upgrade my machine to 64bit CentOS at FastHosts. They said that it wasn’t supported, and they couldn’t upgrade my server until my contract runs out (in September – it’s now april). Wow. Okay, unbelievable as that sounds, I press on, send them a firm, but still polite email asking how to I get this upgraded to 64bit. They recommend using eRIC. The instructions are okay, but there are a few missing points, so hence this post.

My server is a “DS650” which is a dual core 2.4Ghz machine. First note all the settings on your box. IP address(es), netmask, gateway and nameservers is a good start. Backup your stuff, since this will blow your files away ūüôā

1. Setup a windows share (samba) with a CentOS iso on it. I tried using windows, and forwarding the ports, but it didn’t work. the eRIC share wouldn’t pick it up (even though I could mount it over the internet on a mac and a remote windows box). Anyway, the samba worked first time.

2. Log in to fasthosts https://login.fasthosts.co.uk/

3. Click on Dedicated Servers (tab)

4. Click on the server that you want to upgrade.

5. Click on Remote KVM Access

6. Click Enable KVM Access

7. Click on the IP address after “Login Address”. (you should also note the link below “View your server Login Details” page that has the user pass that you need.¬† It’s under “Remote KVM details” on that page.

9. So as long as you have java installed on your computer: Login

10. Click on Virtual Media -> CD-ROM

11. Share host is the ip address of your machine that has the mapped drive (must be accessible on the internet), share name is the share name of the cdrom (eg “D” or “cdrom”), I had to enter my user and pass for that machine to get access to the share (depends on your share config… I tested with another computer first to ease the pain)

Path to image /centosnet.iso

click set

(Just a note here that I’m almost certain it was /centosnet.iso, but it might be without the /). And of course I downloaded that centos netinstall, copied it to my share as centosnet.iso.

Click Remote Control on the left, click KVM Console.

Now log into the server using this console and reboot the server, as soon as it comes up, hit F2 to go into the bios (although for some servers, it will be “DEL”, or perhaps “F8”).

I had a lot of problems with eRIC and typing (repeat characters) .. and I’ve seen this before with other systems. So just type very slowly (wait for the character to appear on the screen before typing the next one). Perhaps there is an option to turn off keyboard repeat?

Arrow down to Boot Options, hit enter, then arrow down to Boot Sequence

Hit Enter, and now move the CD-Rom up above BootManage PXE, Slot 0B20 (by using ‘-‘ key)

Hit escape a few times, and then save and Exit.

Then you get this:

and now it should boot from the cdrom (the mounted drive!). This could be really slow (for me it was around 50k/sec, not too bad, but wouldn’t want to do the 4G CENTOS install using that!).
Here is the CentOS install just starting:

Save and exit, and now it should boot from the cdrom (which might be really slow.. depending on the connectivity back to your mounted drive).

Woo hoo .. CentOS install screen:

I used “linux text” to do the install. This is because the local mouse was out of sync with the remote mouse, and it was incredibly painful.

Manual IP address:

Configure network:

HTTP Setup:
Web site name: mirror.centos.org
CentOS Directory: centos/5.4/os/x86_64

Setup starting:

As I mentioned earlier, the mouse was out of sync when using eRIC, so I chose to use the text install. But how cool is this? The installer now has a VNC option. So I chose it:

and then choose a VNC password:

I sometimes use a mac, and so to then it was a simple as “Apple-K” when in the finder to connect to something remote, and then enter
vnc://217.xx.yy.zz:5901 and click “Connect”

hmm: no encryption… fine with me…

and sure enough up comes the normal CentOS graphical installer:

And the rest is your normal install from there.

I ran into a problem where the drives were going 2mb/s (crazy slow), so long story short, add ide0=noprobe ide1=noprobe to kernel settings: eg in /etc/grub.conf

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

I recently installed CentOS remotely on a machine in the UK.  Now, I want to configure the drives to run raid 0 for /www.

1. create the partitions (and possibly reboot)
2. mdadm -C /dev/md0 --level=raid0 --raid-devices=2 /dev/hda3 /dev/hdc1
3. mkfs.ext3 /dev/md0
4. create /etc/mdadm.conf
echo 'DEVICES /dev/hda3 /dev/hdc1' > /etc/mdadm.conf
mdadm --detail --scan >> /etc/mdadm.conf
4. create mount point: mkdir /www
5. Add line to /etc/fstab: /dev/md0                /www                       ext3    defaults        1 1
6. mount /www

I have two drives /dev/hda and /dev/hdc.  /dev/hda has a swap and ext3 partition (the os) on it already.

[root@uk1 conf.d]# <strong>ls -la /dev/hd*</strong>
brw-r----- 1 root disk  3, 0 Mar  7 11:21 /dev/hda
brw-r----- 1 root disk  3, 1 Mar  7 11:21 /dev/hda1
brw-r----- 1 root disk  3, 2 Mar  7 11:21 /dev/hda2
brw-r----- 1 root disk 22, 0 Mar  7 11:21 /dev/hdc

Create some partitions with fdisk:

[root@uk1 /]# <strong>fdisk /dev/hda</strong>

Command (m for help): <strong>p</strong>

Disk /dev/hda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        6374    51199123+  83  Linux
/dev/hda2            6375        7011     5116702+  82  Linux swap / Solaris

Command (m for help): <strong>n</strong>
Command action
e   extended
p   primary partition (1-4)
<strong>p</strong>
Partition number (1-4): <strong>3</strong>
First cylinder (7012-30401, default 7012):<em>Hit Enter</em>
Using default value 7012
Last cylinder or +size or +sizeM or +sizeK (7012-30401, default 30401): <strong>+200G</strong>
Value out of range.
Last cylinder or +size or +sizeM or +sizeK (7012-30401, default 30401): <strong>+180G</strong>

Command (m for help): <strong>w</strong>
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@uk1 /]# <strong>fdisk /dev/hdc</strong>

The number of cylinders for this disk is set to 30401.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): <strong>p</strong>

Disk /dev/hdc: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System

Command (m for help): <strong>n</strong>
Command action
e   extended
p   primary partition (1-4)
<strong>p</strong>
Partition number (1-4): <strong>1</strong>
First cylinder (1-30401, default 1):<em>Hit Enter</em>
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-30401, default 30401): <strong>+180G</strong>

Command (m for help): <strong>w</strong>
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@uk1 /]# <strong>ls /dev/hd*</strong>
/dev/hda  /dev/hda1  /dev/hda2  /dev/hdc  /dev/hdc1

So we notice that /dev/hda3 is not showing. So we can’t create the raid array till it’s available. So we reboot.

[root@uk1 cameron]# ls /dev/hd*
/dev/hda  /dev/hda1  /dev/hda2  /dev/hda3  /dev/hdc  /dev/hdc1

And so we continue…

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

Which outputs:

mdadm: /dev/hdc1 appears to contain an ext2fs file system
    size=80192K  mtime=Sat Mar  6 13:45:53 2010
Continue creating array? y
mdadm: array /dev/md0 started.
[root@uk1 ~]#

now add the following line to /etc/fstab:

 /dev/md0                /www                       ext3    defaults        1 1

then:

mkdir /www
mount /www

done.

I guess people usually complain when they post about their various dealings with companies, and well, this post will be no different.

My first problem was that my server died after a few days, so this was fixed within a day or two, and they gave me 1-2 months free. Good for some, okay for me.

Now I’m trying to upgrade to 64 bit centos.¬† They don’t support it! (some comment about don’t support it on older servers), and they won’t let me upgrade my server till the 1 year contract expires in September (6 months away!) crazy!!

On the bright side, they did provide information for me to do it myself. (on the downside, it didn’t work, but that’s a pending issue, I’m sure I’ll get it going).

Also on the downside: 24/7 support.¬† Well, actually they don’t have 24/7 support for their dedicated servers.¬† At least according to the lady I just called (it’s 6:44am Friday there), and she said they don’t open till 9:30am.¬† Crazy stuff (and the reason for this post.¬† Because my server is down, I can’t reboot it, I can’t get kvm access to it, and .. well .. it’s down .. not good). Perhaps I’m spoiled by “theplanet” in the US (but their UK servers are too expensive for me $300/mo).

Can’t upgrade the server .. that’s just crazy…

Cameron

I’m using 64 bit CentOS, and frequently forget how to get the java plugin working, usually something like make some symbolic link.¬† Anyway here is what I do:

download and install java from sun.

then

sudo sh ./jdk-6u18-linux-x64-rpm.bin
cd ~/.mozilla/plugins
ln -s /usr/java/jdk1.6.0_18/jre/lib/amd64/libnpjp2.so .

now restart your browser.

http://www.flamingtext.com/java/ has a little java applet on it.

If you have problems finding libnpjp2.so, then use “locate libnpjp2.so”, and if you just installed the java software from sun, then you might need to do “sudo updatedb” first, then locate…