Some plants secrete oils during dry periods, and when it rains, these oils are released into the air. The second reaction that creates petrichor occurs when chemicals produced by soil-dwelling bacteria known as actinomycetes are released. These aromatic compounds combine to create a pleasant petrichor scent when rain hits the ground.
Another scent associated with rain is ozone. During a thunderstorm, lightning can split oxygen and nitrogen molecules in the atmosphere, and they, in turn, can recombine into nitric oxide. This substance interacts with other chemicals in the atmosphere to form ozone, which has a sharp smell faintly reminiscent of chlorine.
When someone says they can smell the rain coming, it may be that wind from an approaching storm has carried ozone down from the clouds and into the person's nostrils.