  Let $p$ be a prime. We define the deficiency of a finitely-generated pro-$p$
group $G$ to be $r(G)-d(G)$ where $d(G)$ is the minimal number of generators of
$G$ and $r(G)$ is its minimal number of relations. For a number field $K$, let
$K_\emptyset$ be the maximal unramified $p$-extension of $K$, with Galois group
$G_\emptyset = Gal(K_\emptyset/K)$. In the 1960s, Shafarevich (and
independently Koch) showed that the deficiency of $G_\emptyset$ satisfies
$$0\leq \mathrm{Def}({\rm G}_\emptyset) \leq dim (O_K^\times/(O_K^{\times
})^p),$$ relating the deficiency of $G_\emptyset$ to the $p$-rank of the unit
group $O_K^\times$ of the ring of integers $O_K$ of $K$. In this work, we
further explore connections between relations of the group $G_\emptyset$ and
the units in the tower $K_\emptyset/K$, especially their Galois module
structure. In particular, under the assumption that $K$ does not contain a
primitive $p$th root of unity, we give an exact formula for $\mathrm{Def}({\rm
G}_\emptyset)$ in terms of the number of independent Minkowski units in the
tower. The method also allows us to infer more information about the relations
of G$_\emptyset$, such as their depth in the Zassenhaus filtration, which in
certain circumstances makes it easier to show that G$_\emptyset$ is infinite.
We illustrate how the techniques can be used to provide evidence for the
expectation that the Shafarevich-Koch upper bound is "almost always" sharp.
