Petting your whining dog in an attempt to comfort may in fact be the wrong thing to do. In essence, you are reinforcing the whining behavior during the storm.
Instead, try distracting the dog by inviting him to do something else and praising that activity. And importantly, make sure your dog is in a safe place in the home away from windows and other glass...just to make sure his fear will not lead to injury.
For the really terrified pet, consult your veterinarian for medications that can be used during a thunderstorm.