Peel and finely chop the onions and garlic. Grate the parmesan. Knead minced meat, egg, half onion and garlic, breadcrumbs, 2 tablespoons parmesan, rosemary, salt and pepper. Form approx. 20 small balls from the minced mass.
For the spaghetti, boil 3-4 l salted water (1 teaspoon salt per litre). Heat the oil in a pan. Fry the meatballs for 8-10 minutes. Cook the noodles in boiling water according to the instructions on the packet until al dente.
Remove the meatballs from the pan. Sauté the rest of the onion and garlic in the frying fat. Pour on the strained tomatoes, bring to the boil briefly and simmer for about 10 minutes. Season sauce with salt, pepper and sugar.
Warm the meatballs in the sauce. Drain spaghetti, drain well and mix with the sauce. Serve with the rest of the parmesan.