We present an extensive first-principles study of a large set of native defects in MoS2 in order to find out the types and concentrations of the most important defects in this system. The calculations are carried out for both bulk and monolayer forms of MoS2, which allows us to study how defect properties change between these two limiting cases. We consider single- and few-atom vacancies, antisites, adatoms on monolayer, and interstitials between layers in the bulk material. We calculate the formation energies of neutral and charged defects, determine the charge transition levels, and from these self-consistently assess the concentration of defects at thermal equilibrium as well as the resulting positions of the Fermi level. The chemical potential values corresponding to different growth conditions are carefully accounted for, and for all values of chemical potentials relevant to the growth of MoS2, the S vacancies are found to be the most abundant defects. However, they are acceptors and cannot be the cause of the often observed n-type doping. At the same time, Re impurities, which are often present in natural MoS2 samples, naturally provide good n-type doping behavior. We also calculate migration barriers for adatoms and interstitials and discuss how they can affect the growth process.