It can’t rain forever…

March 7, 2008

DMRAID on Ubuntu with SATA fakeraid

Filed under: Linux — bbossola @ 7:40 pm
Tags:

The problem
Ubuntu (and Debian) doesn’t have support for the SATA RAID (also called FakeRAID since some of the functionality is provided by software) controllers being shipped on recent motherboards. The software to handle FakeRAID arrays in Linux is DMRAID. How do I install such systems?

.
Preliminary Operations
You will need to configure your RAID using the bios utility (Ctrl+M for me on startup) : just select your disks, create the logical unit selecting your desired raid mode (0 or 1 for me), save and boot with a desktop live CD.

Note: in this example I’m using Fujitsu Siemens Primergy RX100 S4 equipped with two 160Gb SATA drives, and I’m creating a RAID0 array, with Ubuntu Linux 7.10 Gutsy Gibbon

.
1st phase - create your partitions

To create your partitions you’ll need that your RAID is reconized from your system. Unfortunately, at the time I’m writing, Ubuntu does not include DMRAID support in its install procedure, so you’ll need to start with a live CD, activate DMRAID support and proceed to partitioning.

  • start your system with an Ubuntu Desktop CD (select your language if needed)
  • open a terminal (CTRL-ALT-F1), set a new root password wih “sudo passwd root”
  • go on with “su - ” (digit your password)
  • edit /etc/apt/sources.list, uncomment universe packages
  • “apt-get update”
  • install dmraid: “apt-get install dmraid”
  • Launch fdisk specifying the shorter device you find under /dev/mapper/dxxx (dxxx is the file device with shorted name, es.: dxxxa28 is the correct one, dxxxa281 the wrong one)
  • create a primary partition of 316GB, the other with the remaining space (we’ll use it for swap)
    • n <enter>
    • p <enter>
    • 1<enter>
    • <enter>
    • +316GB
  • create a primary partition with the remaining space:
    • n <enter>
    • p <enter>
    • 2 <enter>
    • <enter>
    • <enter>
  • change second partition type:
    • t <enter>
    • 2 <enter>
    • 82 <enter>
  • save with “w”, <enter>
  • restart your system with “reboot”

.

2nd phase - installing a minimal ubuntu
To format your partitions you’ll need DMRAID module loaded. So you’ll need to repeat the first six previous steps.

  • format your root partition
    • mkfs -t ext3 /dev/mapper/dxxx1 (select the device ending with 1)
  • prepare a local area for the installation procedure: create a local folder, mount your formatted partition on that folder, bind and mount the necessary stuff
    • mkdir /target
    • mount /dev/mapper/dxxx1 /target
    • mkdir /target/dev
    • mount  - - bind /dev/ /target/dev
    • mkdir /target/proc
    • mount -t proc proc /target/proc
    • mkdir /target/sys
    • mount -t sysfs sys /target/sys
  • proceed installing a minimal ubuntu
    • apt-get install debootstrap
    • debootstrap gutsy /target
  • copy essential files on your partition
    • cp /etc/apt/sources.list /target/etc/apt/
    • cp /etc/resolv.conf /target/etc/
    • cp /etc/hosts /target/etc/
    • cp /etc/network/interfaces /target/etc/network/
  • switch on your new system, re-mount /proc, /sys, /dev
    • mount  - - bind /dev/ /target/dev
    • mount -t proc proc /target/proc
    • mount -t sysfs sys /target/sys
    • chroot /target
  • install a basic ubuntu system
    • apt-get update
    • apt-get install language-pack-en
    • apt-get install ubuntu-standard linux-generic dmraid grub
  • create a user, if you want
    • useradd pippo
    • passwd pippo
    • mkdir /home/pippo
    • chown pippo /home/pippo
  • set root password
    • passwd root

.

3rd phase - boot loader configuration
Yes, you’ll need to configure grub

  • copy grub essential files
    • mkdir /boot/grub
    • cp /usr/lib/grub/i386-pc/stage1 /boot/grub/
    • cp /usr/lib/grub/i386-pc/stage2 /boot/grub/
    • cp /usr/lib/grub/-pc/* /boot/grub/
      This will copy the staging file for the various filesystem in your boot partition. In my example the directory is “/usr/lib/grub/i386-pc/” and the files that are copied are “e2fs_stage1_5″, “jfs_stage1_5″,…
  • configure di grub
    • grub (enters grub interactive shell)
    • device (hd0) /dev/mapper/dxxx (the shorter, so the logical disk, not the partition)
    • root (hd0,0)
    • setup (hd0)
    • quit (exit from grub shell)
    • update-grub (update grub files)
  • configure grub menu
    • edit grub menu.lst: “vi /boot/grub/menu.lst”
    • check groot is pointing to hd0,0 (it should be necessary to uncomment that line)
    • check that savedefault is commented (normally is)
    • modify, inside “kernel” items, the “root” value to “/dev/mapper/dxxx1″ (your root partition)
  • configure static mount under /etc/fstab

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/mapper/ddf1_LogicalDrive_01 / ext3 defaults 0 1
/dev/mapper/ddf1_LogicalDrive_02 none swap sw 0 0

  • reboot :)

Bottom line
Well, you’ve done! Remember that if you mounted a RAID0 device Linux at startup will probe your disks and he’ll wrongly detect a bad partition table: ignore error messages http://osdir.com/ml/linux.ataraid/2006-10/msg00019.html

Little tips:

Links
http://www.ubuntu-in.org/wiki/SATA_RAID_Howto
https://help.ubuntu.com/community/FakeRaidHowto
http://salaros.blogspot.com/2007/07/installare-ubuntu-704-su-raid0-in-dual.html

March 3, 2008

JUG Torino March meeting!

Filed under: Java, Speech — bbossola @ 11:37 am

JUG Torino logoMarch meeting of Java User Group Torino will take place on 7th with this schedule:

  • 18.30: Check-in!
  • 18.45: Seminar:JetBrains, the IDE! by Vaclav Pech (JetBrains)
  • 20.00: EOF (as usual, maybe having a VeryBigPizza all together!)

You may find more info about the event here.

February 22, 2008

What’s happening at Savigano Irpino?

Filed under: Life — bbossola @ 1:12 pm

I can’t comment it… please watch the video :(

January 26, 2008

JUG Torino January meeting!

Filed under: Java, Speech — bbossola @ 8:02 pm

JUG Torino logoJanuary’s meeting of Java User Group Torino will take place on 30th with this schedule:

  • 18.30: Check-in!
  • 18.45: Quickie: “SopaUI by Federico Fissore (JUG Torino)
  • 19.00: Seminar: “Java6 update! by Bruno Bossola (JUG Torino)
  • 20.00: EOF (as usual, maybe having a VeryBigPizza all together!)

You may find more info about the event here.

January 23, 2008

Business logic: how do you return on application errors?

Filed under: Java, Object Oriented — bbossola @ 5:46 pm

(note: post will be translated in English as soon as possible)

Oggi qui siamo alle prese con una decisione di design che non ci decidiamo a prendere :), ho parlato un po’ con il gruppo e con alcune vecchie conoscenze ma non ho ancora trovato una soluzione pienamente soddisfacente: cosi mi rivolgo a voi, magari avete consigli “sbloccanti”.

Normalmente nelle applicazioni che disegno cerco sempre, come molti, di disaccoppiare la logica di presentazione da quella di business: la user interface si occupa di interagire con l’utente, mantenendo lo stato conversazionale, mentre nella business logic troviamo il domain model con le logiche di business che si applicano ad esso.Attenzione: non stiamo parlando di applicazioni CRUD che si limitano ad usare un interfaccia utente per scrivere su DB, ma di programmi con un domain model articolato, che eseguono elaborazioni di una certa complessità una volta che la richiesta dell’operazione è stata inserita tramite una user interface (web, swing, xul che sia, non è interessante). Dovendo quindi disaccoppiare questi due strati tendo ad esporre dal lato business un’insieme di “servizi”: non pensate alla tecnologia, è semplicemente una scelta di design, che poi potrà essere implementata con dei POJO, dei web services, degli EJB, qualunque cosa ci venga in mente poi di ficcarci in mezzo.(proprio perchè la tecnologia è un mezzo, non un fine :D).

Avremo quindi dei servizi come questo: (scrivo in pseudo-java, ma potrei anche usare IDL)

// una delle interfacce della business logic
public interface MyService
{
   public void executeComputation(Slot slot, Computation compu)
   ;

   public Slot[] selectAvailableSlots(Range range)
  ;
}

(notate come stia esponendo una parte del domani model, ma questa è un’altra storia)

Essendo questa della business logic vera ci sono anche delle regole di business che devono essere verificate, e questo è possibile farlo solo a livello di business (certamente la presentation fa il suo lavoro per validare e scremare i dati ineriti, ma si limita a quello). Esiste quindi un’intera classe di errori che la business logic puo’ generare a causa della violazione delle business rules del momento, che non sono comunque verificabili in nessun modo a priori dalla presentazione (sia perché queste possono variare rapidamente sia perché mi piace che non ne sappia un cacchio!).

Come fare a ritornare queste condizioni di errore? Io finora ho individuato due macro-soluzioni:
a) utilizzare un’eccezione applicativa (aka BusinessRuleException) contenente l’errore
b) utilizzare un valore di ritorno contente sia il risultato sia l’eventuale errore

La soluzione (a) mi piace proprio poco. Utilizzare le eccezioni per modificare il controllo di flusso è da sempre, almeno per me, una vera schifezza e inoltre rende il codice assai poco leggibile. Le eccezioni devono secondo me rappresentare eventi di tipo appunto eccezionale (problemi sull’infrastruttura, ad esempio il DB si è disconnesso, non si riesce a contattare un servizio secondario, ecc.ecc) e come tali vanno gestite. Pertanto, pur essendo tanto attraente almeno superficialmente, la scarterei.

La soluzione (b) è secondo me la più naturale, d’altronde la violazione di una business rule è una cosa perfettamente naturale per la business logic, ma si porta dietro anch’essa un codice un po’ pasticciato. Non posso pensare di realizzare tante classi *Result differenti per gestire la varietà dei risultati forniti dalla business logic (nel caso in oggetto un metodo è void mentre l’altro ritorna un array) e pensandoci un po’ ho trovato questa soluzione tecnica, che ancora non mi convince del tutto: realizzare una classe Result con i generics e quindi modificare la firma dei metodi in modo che tornino questa. Il codice, tanto per chiarire, sarebbe questo:

// la classe che incapsula il risultato di una chiamata al business (value object)
public class Result {
   private F value;
   private Error error;

   public Result(F value) {
       this(value, Error.NONE);
   }

   public Result(F value, Error error) {
       this.value = value;
       this.error = error;
   }

   public F value() {
       return value;
   }

   public Error error() {
       return error;      }
}

L’interfaccia del servizio (di tutti i servizi) sono modificate in questo modo, ritornando un Result generico in ogni caso:

interface MyService
{
   public Result executeComputation(Slot slot, Computation compu)
   ;

   public Result<Slot[]> selectAvailableSlots(Range range)
   ;
}

Ok, fine dell’elucubrazione. Il punto è: cosa ne pensate? Io sto per muovermi su quest’ultima soluzione.

November 20, 2007

Pidgin & OpenFire

Filed under: Java, Life — bbossola @ 7:33 pm

Openfire (aka WildFire) a very well known jabber server won’t work with Pidgin, a famous IM client, because of a lack of support by Java in RFC 2831implementation, as you can also read here, here and here.

Before giving up digging inside Openfire awkward documentation and obscure groups suggestions just pick up you openfire.xml file in /opt/openfire/conf and add, just before closing </jive> elements, these few sentences:

<sasl>
<mechs>PLAIN</mechs>
</sasl>

They’ll do the job.

October 28, 2007

Cruelty, not art

Filed under: Life — bbossola @ 12:23 am

An “artist” from Costa Rica, named Guillermo Habacuc Vargas, put a starved dog as a work of art, the poor dog died there, he did not want anyone give him food or water. This “man” asked some children to chase the dog and he paid them for their dirty work to give him the dog.

See details here (in italian), I hope you’ll also sign the online petition

October 12, 2007

JavaDay in Turin, October 20th

Filed under: Uncategorized — bbossola @ 5:12 pm
JavaDay Torino Banner

On its second edition, the Javaday is an initiative organized by the Italian Java User Groups, by the community of Java Italian Portal and by the Java Italian Association with the goal to promote the knowledge and the usage of the Java technology. JavaDay is an on road gig that touches different italian cities all along the peninsula, spreading the Java technology also in places usually skipped out by big events. This feature makes the JavaDay a qualifying and unique moment: every single stage is a direct communication channel in which the technology, the local institutions, the developers and the companies can meet together in order to know each other, share knowledge, compare each other and understand the new opportunities offered by the Java Platform. The participation to the JavaDay is free.

JavaDay Torino Logohttp://javaday.jugtorino.it

September 27, 2007

Live from Sun Tech Days

Filed under: Java — bbossola @ 11:35 am

Hi, blogging live from Sun Tech Days here Milan! People is coming, and the place is getting crowded :) The first person I met was Roman Strobl, who’s still setting up his demos for today. Unfortunately I’ll be able to stay only this morning, but I’ll do my best to get the most from the event, even if I’ll be stuck at JUG desk.

August 31, 2007

JUG Torino September’s meeting!

Filed under: Java, Life, Speech — bbossola @ 7:56 pm

JUG Torino logoSeptember’s meeting of Java User Group Torino will take place on 21h with this schedule:

  • 18.30: Check-in!
  • 18.45: Quickie: “What about Hudson? by Bruno Bossola (JUG Torino)
  • 19.00: Seminar: “GWT, a Web2.0 toolkit! by GianCarlo Pace (JUG Milano)
  • 20.00: EOF (as usual, maybe having a VeryBigPizza all together!)

You may find more info about the event here.

Next Page »

Blog at WordPress.com.