Sacrificial metal

A sacrificial metal is a metal used as a sacrificial anode in cathodic protection that corrodes to prevent a primary metal from corrosion, galvanization or rusting.
Equation.
When two metals touch each other and water is present, electrolysis occurs. One well known example is the reaction between zinc (Zn) and iron (Fe). Zn atoms ionizing as it is more electronegative and is oxidized and corrodes.
Zn(s)→(aq) +2e (oxidation)
Uses.
Sacrificial metals are widely used to prevent other metals from rusting, for example galvanised steel. Most of the steel object is coated with a layer of zinc, which is more electronegative than the iron, preventing it from rusting. Similarly, sacrificial bars of a metal such as magnesium can be attached to an oil rig or the hull of a ship to prevent it from rusting and breaking down.