Rinse the octopus under cold water and check that the beak and eyes are gone. Bring enough water to cover the octopus, about 4 quarts / 4 L, to a boil in an 8-quart / 7.5 L stockpot with the halved onion and 2 bay leaves. Hold the octopus by the head with tongs, dip it into the water for 3 seconds, lift it out, and repeat twice more so the tentacles curl. Lower it in, drop the heat to a gentle simmer, and cook partly covered for 50 minutes, until a thin knife slides into the thickest part of a tentacle near the head with little resistance. If the knife grips, simmer 10 minutes longer and test again.
When the octopus has about 25 minutes left, put the potatoes in a 3-quart / 2.8 L saucepan with cold water to cover and 1 tbsp salt. Bring to a boil, then simmer for 20 to 25 minutes, until a knife tip slides in easily.
Turn off the heat under the octopus and leave it in the cooking liquid for 15 minutes. Meanwhile, heat the oven to 200 C / 390 F with a rack in the middle. Drain the potatoes and let them steam for 3 minutes. Cover each one with a folded dish towel and press with the heel of your hand until it splits but holds together.
Lift the octopus onto a cutting board. Cut the tentacles from the head, cut each tentacle into 10 cm / 4 inch pieces, and cut the head into 4 pieces, leaving the skin and suckers on. Arrange the potatoes and octopus in a single layer in a 40 x 30 cm / 16 x 12 inch roasting pan and scatter the smashed garlic among them. Pour the olive oil over, sprinkle with 3/4 tsp salt and the pepper, and turn the pieces to coat.
Roast for 30 minutes, spooning the pan oil over the octopus after 15 minutes, until the potato edges are crisp, the tentacle tips are browned, and the garlic is golden.
Sprinkle with the parsley and serve from the pan, with lemon wedges on the side and the garlicky oil spooned over each plate.