Igneous (from ignis for "fire") rocks form by the solidification of molten material within or on Earth's surface.
Sedimentary (from sedimentum for "settling") rocks by the hardening of sediments near Earth's surface.
Metamorphic (meta for "form" and morphe for "change") form within the Earth as a result of heat, pressure, or fluid interactions.
Igneous and metamorphic rocks compose about 95% of the Earth's crust, but much of those rocks are covered with sedimentary rocks.
As you probably have noticed, Earth contains many varieties of rocks. To make sense of the variations, we must develop a classification system to guide and clarify our rock studies. Rocks are classified on the basis of their mineralogy, texture, and fabric.
Each rock tells the story of its history, which is often the result of the complex interaction of the dynamic processes operating within and at the surface of Earth.
The relationship of different rocks and the processes of geology is called the rock cycle. We can classify these processes based on their energy sources: internal energy and external energy.
Internal energy drives plate tectonics and produces magmas that cool to form igneous rocks. These rocks can be subducted back into the mantle later or metamorphosed during tectonic activity.
All rocks can be weathered and eroded by the externally-driven hydrologic cycle. The energy to drive the hydrologic cycle is the Sun.