Nuclear and magnetic structures and magnetic properties of the layered cobalt hydroxysulfate Co5(OH)6(SO4)2(H2O)4 and its deuterated analogue, Co5(OD)6(SO4)2(D2O)4.