Lewis Hamilton led Ferrari teammate Charles Leclerc to the top of the FP2 leaderboard at the Azerbaijan Grand Prix after both McLaren drivers struck the wall on their flying laps.