We present an empirical connection between cold gas in galactic halos and star formation . Using a sample of more than 8,500 Mg ii absorbers from SDSS quasar spectra , we report the detection of a 15 \sigma correlation between the rest equivalent width W _ { 0 } of Mg ii absorbers and the associated [ O ii ] luminosity , an estimator of star formation rate . This correlation has interesting implications : using only observable quantities we show that Mg ii absorbers trace a substantial fraction of the global [ O ii ] luminosity density and recover the overall star formation history of the Universe derived from classical emission estimators up to z \sim 2 . We then show that the distribution function of Mg ii rest equivalent widths , \mathrm { d } N / \mathrm { d } W _ { 0 } inherits both its shape and amplitude from the [ O ii ] luminosity function \Phi ( L ) . These distributions can be naturally connected , without any free parameter . Our results imply a high covering factor of cold gas around star forming galaxies : C \gtrsim 0.5 , favoring outflows as the mechanism responsible for Mg ii absorption . We then argue that intervening Mg ii absorbers and blue-shifted Mg ii absorption seen in the spectra of star forming galaxies are essentially the same systems , implying that the observed outflowing gas can reach radii of \sim 50 kpc . These results not only shed light on the nature of Mg ii absorbers but also provide us with a new probe of star formation , in absorption , i.e . in a way which does not suffer from dust extinction and with a redshift-independent sensitivity . As shown in this analysis , such a tool can be applied in a noise-dominated regime , i.e . using a dataset for which emission lines are not detected in individual objects . This is of particular interest for high redshift studies .