The figure of speech that uses a part to represent the whole, as in “all hands on deck,” is synecdoche.
In the example, “hands” refers to the sailors or crew members who are needed on deck. The hands are literally part of the people, so the expression substitutes a physical part for the complete group. Synecdoche can also work in the opposite direction, with a whole standing for one of its parts; these patterns are sometimes described by the Latin terms pars pro toto and totum pro parte.
The term comes from Greek through Latin rhetorical vocabulary. Synecdoche is commonly treated as a type of metonymy, but the distinction is useful: synecdoche depends on a part-whole relationship, while metonymy more broadly substitutes something associated with the intended subject. Thus “wheels” for a car is synecdoche, while “the crown” for a monarch is usually metonymy.
Other everyday examples include “hired hands” for workers, “mouths to feed” for people, and “boots on the ground” for soldiers. Personification gives human traits to nonhuman things, and metaphor compares unlike things, so neither describes the specific part-for-whole pattern in the question.