We'll start with a pretty easy one. Egypt grew mostly grain. In general, the floodwaters of the Nile covered most of the farmland with silt every year, providing both water and nutrients to the soil. This allowed for (reasonably) reliable harvests, barring disease or faliure of the floodwaters. Grains were stored in granaries, as the name might suggest. Egyptian granaries looked like this:
If you remember your Bible stories/ Andrew Lloyd Webber musicals: Joseph told them to store up grain for a coming famine. They already did that, but I guess it was good advice anyway. With the climate being so dry, grains stayed edible for several years, and the shape of the granaries- raised but covered- helped create a preservative environment. Keeping them off the ground also made it harder for pests to invade the supply.
The Egyptians also had not-so-secret weapon: Cats. We all know that the Egyptians worshipped cats, and mummified them after they died, but one of the origins of this worship is thought to be their excellent pest-destroying activities. The local wildcats (from whom DNA suggests the Egyptians' cats were domesticated) killed not only rats and mice, but cobras and other poisonous snakes. Of course, this is pretty reductive; if simply killing vermin were enough to cause a culture to worship an animal, there would have been cat-cults all over Napoleonic ships and in every palace kitchen. Unfortunately, the origins of religions are obscure- this is the kind of thing cognitive science of religion is trying to deal with- and many of us in ancient history have stopped trying to search for the origin of religions. We usually don't get anywhere, and when we do we haven't actually learned anything new. Still: CATS.
Bronze statue of a cat and her kitten, Ancient Egypt (be more specific, won't you Wikipedia?)
The Romans did not have such a hospitable climate in much of their empire, especially not from Britain where our next example is from. Recognise this?
No? Okay then, it's the granary from the Roman fort at Housesteads, on Hadrian's Wall. You'll notice that the floor is covered in square stones. Actually, it's not the floor; those stones would have held up a floor that no longer exists, allowing air to circulate beneath the grain. This helps prevent mould, as anyone living in a student house will know ("Just keep the window's open" "It's winter!" "If you don't keep the windows open, you'll get mould" "?!?!"). It may also have helped keep pests out, though it's unclear whether a foot or so was really enough.
Notice how thick the walls are? This granary (and the one next to it) had to feed the entire garrison from one harvest to the next (presumably- grain transport is tedious, so it makes sense to put it all in once place once it's been taxed off the locals and keep it there). They would pile literally tons of grain up against the walls, so they needed to be pretty sturdy.
Hang on a second! Walls aren't waterproof! (This is true, actually. It's how damp gets into houses). Romans knew that too, so their granaries had extra wide eaves
This is not a Roman granary, it's a helpful visual aid
This kept water off the walls, and thus, the grain was saved!
This one is by far the best and most interesting. As long as by "best" we mean MOST AWESOME. By Medieval times, barns were often massive affairs, intended to hold the tithe grain from large numbers of peasant farmers. They were simply too big to be raised up. If you've ever been into the Buckland Abbey tithe barn, you'll know what I'm talking about.
The roof has been replaced, but the walls and floor are, to my knowledge, original.
However, they had one, awesome and totally amazing innovation: owl chutes. This is a small hole or chute in the wall or roof of the granary which allows owls (most often barn owls) to enter the granary. The owls then find and eat the mice, preventing the mice from eating the grain!
(No, I'm not making this up)
This one is from a modern archaeologist, who mostly works on the European Iron Age (though he gets around a lot): Barry Cunliffe. You know what he once called Classical Archaeology?