Preheat oven to 200c/180C fan/Gas 6.
Butter ramekins or muffin tins and white pepper, then sprinkle with salt, pepper, sugar, and vinegars.
Place a rosemary sprig in the bottom of each ramekin, then lay one onion round over the rosemary.
Toss potatoes with egg, rosemary, and 2 teaspoons coarse salt.
Divide the potatoes into ramekins and dot with remaining butter. Bake for 30 minutes, until golden brown.
To remove the cakes, slide a knife around the edge of the ramekin, then turn upside down.