In hard disk drive manufacturing, the servo tracks are written with the equipment of servo track writer. External vibrations during servo track writing process give rise to servo track writing error. The servo track writing error can cause some critical errors during data writing operation. This paper proposes two control schemes using an effective Finite Impulse Response (FIR) compensator to attenuate external vibrations based on optimization technique. The former aims to decrease the error in each frequency by minimizing the sensitivity transfer function from command/disturbance to error. It is constructed in a feedback control loop without any sensor to detect vibrations. The latter is also designed in the frequency domain with a slightly different objective function. Here the designed compensator is constructed in a feedforward scheme with a use of accelerometer to measure vibrations. Without a mathematical model of the system, the FIR compensator from the two structures can be practically designed by using the experimental data of the system. The more number of gains used in the compensator design, the better the performance. Weighting functions are applied to emphasize on the addressed frequencies where the vibrations usually dominate.