I found a treatment of the subject in some chemistry posts.
(From the Italian Chemist's blog):
…… We feel the rainstorm coming and with it the scent of rain. Is a smell of earth, stale but it's still a nice smell. From what is due?
In 1964, in a paper published in Nature by Bear and Thomas treated oils that plants produce as exudate, especially during dry spells. These oils are absorbed by the soil and rocks, and their components become, when moved by the rain drops, volatile compounds and fill the air with fragrance. The two scientists gave the name of petrichor to this set of substances, which includes several products among which in particular geosmin and 2-methyl isoborneol (MIB). The name petrichor is built from ancient greek and is based on petros (stone) and ichor (golden liquid in the veins of the gods). Also the name geosmin the name comes from the greek, from combination of ge (earth) and Osme (smell) and refers to the property of transmitting the smell of the earth.
Geosmin and MIB are therefore the main odor components that rain moves from the soil on which the plants stands. They are odors that we usually do not like, especially when transmitted to the stream waters which the plants growclose to, and even the fish that live in them. Fortunately, the two compounds are tertiary alcohols and react with acids and as such losing a water molecule, thus becoming no more odorous compounds. This reaction is also used when cooking freshwater fish such as carp, catfish, mullet: a few drops of vinegar, or lemon, are enough to make disappear the smell which is not particularly pleasant.
The geosmin is also sought in the formulation of some perfumes, in small amounts, to give the smell of the earth pleasant and exciting. It is also present in beets and its derivatives, always in adequate quantities for a pleasant use.
The smell of geosmin can be appreciated by humans at very low 0.7 parts per billion. It seems that camels in the desert can feel it, even from distances of 10-15 km it, and chase it until they get to the oasis they search for drinking. And while drinking the spores of Streptomyces (the producers of geosmin) remain attached to the animals that transport you to the desert thus acting as pollinators (this is clearly an example of co-evolution).
As said by American chemists, the smell before rain, however, has a different cause. Particularly, the smell before a thunderstorm is a consequence of the electrical charge present in the atmosphere. This causes the splitting of some oxygen molecules in the atmosphere into individual oxygen atoms, which can then combine with other oxygen molecules in the atmosphere to form ozone, O3. Ozone has a sharp odour, compared by some to that of chlorine, or of burnt wires. It’s unstable in the lower atmosphere, and is usually only found higher up – however, the downdrafts of wind produced by a storm can sweep it down from the higher atmosphere, making it possible for us to detect it, and giving the calm before a storm that ‘pre-rain’ smell.
Bear, I.J.; R.G. Thomas (March 1964). Nature of argillaceous odour. Nature 201 (4923): 993–995. doi:10.1038/201993a
Stromberg, J. What Makes Rain Smell So Good?, http://www.smithsonianmag.com/science-nature/what-makes-rain-smell-so-good-13806085/?no-ist, April 2, 2013