In order to interpret H2 (molecular hydrogen) quasar absorption line observations of damped Ly-alpha systems (DLAs) and sub-DLAs, we model their H2 abundance as a function of dust-to-gas ratio, including H2 self-shielding and dust extinction against dissociating photons. Then, we constrain the physical state of gas by using H2 data. Using H2 excitation data for DLA with H2 detections, we derive a gas density 1.5 < log n [cm^-3] < 2.5, temperature 1.5 < log T [K] < 3, and internal UV radiation field (in units of the Galactic value) 0.5 < log \chi < 1.5. We then find that the observed relation between molecular fraction and dust-to-gas ratio of the sample is naturally explained by the above conditions. However, it is still possible that H2 deficient DLAs and sub-DLAs with H2 fractions less than ~ 10^-6 are in a more diffuse and warmer state. The efficient photodissociation by the internal UV radiation field explains the extremely small H2 fraction (< 10^-6) observed for \kappa < 1/30 (\kappa is the dust-to-gas ratio in units of the Galactic value); H2 self-shielding causes a rapid increase and the large variations of H2 abundance for \kappa > 1/30. We finally propose an independent method to estimate the star formation rates of DLAs from H2 abundances; such rates are then critically compared with those derived from other proposed methods. The implications for the contribution of DLAs to the cosmic star formation history are briefly discussed.