you used глава, which is head (as in head of the company - глава компании), not to be used with 'лук'
with onion it is technically possible to say головка лука, but usually they say луковица (as described earlier).
however головка чеснока (garlic) is used all the time.