Koozali.org: home of the SME Server

Starting custom services at the end of boot time

paquerette

Starting custom services at the end of boot time
« on: June 08, 2007, 09:27:34 AM »
Hi,

  I'd like to start some services (2 webservers, mount a file system) after the boot time.

  the two webserver are a tomcat and fisheyes.

  The filesystem to mount  is a USB one & USB drives are note available at boot time.

I guess I should look into rc config with the templating system...

But if someone share its knowledge, it would be great !

Thomas.

Offline Confucius

  • *****
  • 235
  • +0/-0
Starting custom services at the end of boot time
« Reply #1 on: June 08, 2007, 09:39:58 AM »
rc.local is the file to check out.

And I have to disagree that USB is not an option. I have 2 USB drives in RAID1 setup running with the map /home/e-smith/files data on it and it runs like a charm. During boot I can see that the md0 is checked for errors and md0 is containing those USB drives.

paquerette

Starting custom services at the end of boot time
« Reply #2 on: June 08, 2007, 09:56:49 AM »
Really!  

that's exactly what I'm willing to do, but at boot time,
I've an error when it assemble md devices.


here is my fstab :

Code: [Select]
/dev/main/root          /                       ext3    usrquota,grpquota               1 1
/dev/md1                /boot                   ext3    defaults                        1 2
none                    /dev/pts                devpts  gid=5,mode=620                  0 0
none                    /dev/shm                tmpfs   defaults                        0 0
none                    /proc                   proc    defaults                        0 0
none                    /sys                    sysfs   defaults                        0 0
/dev/main/swap          swap                    swap    defaults                        0 0
#/dev/md0               /mnt/data               ext3    noauto          1 1
/dev/hdc                /media/cdrecorder       auto    pamconsole,exec,noauto,managed 0 0


and here is my mdadm.conf :

Code: [Select]

# mdadm.conf written out by anaconda
DEVICE /dev/hda1 /dev/hda2 /dev/sda1 /dev/sdb1
MAILADDR root
#explicitly define each array
ARRAY /dev/md2 level=raid1 num-devices=2 devices=/dev/hda2 UUID=52937d63:3b5853f5:1d4d7437:f7deb43f
ARRAY /dev/md1 level=raid1 num-devices=2 devices=/dev/hda1 UUID=85e10085:85183b47:35baaf74:54f56e0e
#ARRAY /dev/md0 level=raid1 num-devices=2 devices=/dev/sda1,/dev/sdb1 UUID=1da6f61b:1c6915af:1d65cec7:4ab101f0


the lines are commented so I can boot...

mdadm.conf is correct, when I uncomment the last line and run
mdadm -A /dev/md0

there is no error and i can mount the raid1 in my filesystem.

do you see anything wrong ?

paquerette

Offline Confucius

  • *****
  • 235
  • +0/-0
Starting custom services at the end of boot time
« Reply #3 on: June 08, 2007, 10:46:24 AM »
Have to come back on this later. Sitting at work now. Situation is at home.

I never edited the mdadm.conf. I only used manual commands to create and add drives to md0.

paquerette

Starting custom services at the end of boot time
« Reply #4 on: June 08, 2007, 12:37:37 PM »
ok, i'm eager to see how you did...

Offline Confucius

  • *****
  • 235
  • +0/-0
Starting custom services at the end of boot time
« Reply #5 on: June 10, 2007, 12:41:54 PM »
Took a little longer, Toshiba has great USB drives but some of them get too hot too easy, had to swap it and add a new 1, hot, to the array.

The procedure is actually pretty simple:

fdisk -l to find the drive name attached to you system

fdisk /dev/sda as the drive assumed to work on

clear the drive by starting a new partition and remove the old (in most cases NTFS) partition(s). Options d and n.
When asked for a partition type choose option fd (linux raid auto) and save all information to the disk with w

format the drive now with ext3:

mkfs.ext3 -b 4096 /dev/sda1

So far the actual drive formatting... now you wonder about disk 2 ?
That's simple..

sfdisk -d /dev/sda | sfdisk /dev/sdb assuming sdb is the 2nd USB drive. After this drive 1 is replicated in structure onto drive 2. Easy hah ?

Once this is done you can start to build you array

mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1

That's gonne take as long as needed for the drives to be added, depends on the size and speed of USB.

That was the array-making

when you loose a drive from the array (you can see this when there is NO double U visible in /proc/mdstat anymore) you can simply replace the "broken" drive with :

sfdisk -d /dev/sda | sfdisk /dev/sdb
mdadm -–add /dev/md0 /dev/sdb1

assuming /dev/sdb broke down.

Now you have the possibility to add the array (md0 in this case) to /etc/fstab in whatever way you like. I even use quoata's there because I moved the map /home/e-smith/files to the array.

Good luck.

Harro

paquerette

Starting custom services at the end of boot time
« Reply #6 on: June 12, 2007, 10:14:19 AM »
Thanks Confucius, I'll try it tonight !

(I've been quite busy this weekend)

Thanks again,

Paquerette.

Offline Confucius

  • *****
  • 235
  • +0/-0
Starting custom services at the end of boot time
« Reply #7 on: June 12, 2007, 04:19:01 PM »
Additional note... hard to find out where it was caused. I do know that I installed SME with the command addition NORAID.

The situation I had till now was that during a reboot I lost the (later) added 2nd drive (actually, it was the 1st but was replaced because of heat-problems and was seen as 2nd drive later) in the array.

I edited the /etc/mdadm.conf to become like this :

Code: [Select]
DEVICE /dev/sda* /dev/sdb*
MAILADDR root
MAILFROM Raid Monitor
ARRAY /dev/md0 devices=/dev/sda1,dev/sdb1


Did a reboot and now my server is so friendly to give me a DOUBLE "U" in the status fields (/proc/mdstats). Or in other words... the array is complete from startup.

Wonder now if this was caused by the NORAID addition from me? Maybe somebody knows.

Harro