The most important factor in preventing coffee from going hard in storage containers is by avoiding moisture. Store coffee in a cool, dry location away from sunlight for best results.