USB device accidentally ejects with the slightest disturbance
You either have a bad USB cable or a bad USB jack (either on external devices or Mac). I would start by replacing the USB cable on the external hard drive. If that does not work then your USB jack will most likely need to be looked at by an Apple repair center.