This paper proposes a filtering method to smooth the position error signal (PES) contaminated by impulsive disturbances in hard disk drives. The impulsive disturbances, observed as sudden changes in PES, may be distributed separately or consecutively. A nonlinear switched filtering method is developed to remove the impulsive disturbances before the position error signal is fed into the servo controller. It turns out that the proposed filtering algorithm is able to effectively remove impulsive disturbances in the corrupted PES with no impact on the stability and the servo performance of the original servo loop.