Edaphosaurus was a genus of sail-back synapsid, a group of animals that includes mammals and their relatives. It lived from the late Carboniferous to the early Permian. Even though Edaphosaurus resembled a dinosaur, they were not dinosaurs. They are actually ancestors of early mammals.
The image below shows Edaphosaurus (the lizard-like one with the sail on its back), and the sail-back amphibian Platyhystrix. For some reason this interpretation of Platyhystrix does not have the sail on its back.
Edaphosaurus had spines that held up its "sail." These spines also had small knobs sticking out of them. Scientists think that Edaphosaurus's "sail" was either for warming its body, for attracting a mate, or both. It's possible that it was for the same purpose as antlers or horns on modern day mammals like deer or goats. But nobody really knows what the "sail" was for.
Edaphosaurus was similar to Dimetrodon, but was smaller. Edaphosaurus was three to eleven feet long, and may have been prey for Dimetrodon.
Edaphosaurus was an early plant-eating tetrapod, but it may have not eaten plants, but instead hunted small animals such a mollusks. Or it could have eaten both and been an omnivore.
Most fossils of this synapsid only show teeth and bits of its backbone. Edaphosaurus is rare and its habits are poorly known.