A method is disclosed for improving head position accuracy in a disk drive during track following of concentric data storage tracks through real-time identification of external vibration and monitoring of write-unsafe (WUS) occurrences. In the method, after a seek operation to a predetermined data storage track, the track is followed using a servo control loop having a nominal gain and responsive to a position error signal (PES). After waiting a vibration detection delay period, occurrences of the PES exceeding a WUS limit are counted generating a WUS limit exception count. Also, a property of a variance is determined from spectral power values generated from the PES during track following. If the WUS limit exception count exceeds a first threshold, and if the property of the variance exceeds a second threshold, the nominal gain is increased to a vibration gain within a frequency band, to attenuate the effect of external vibration.