Aiming at solving the problems of slow motion and positioning deviation caused by the change of the moment of inertia of the servo motor due to different loads, an identification method for the moment of inertia on the basis of the error gain factor model is introduced into the controller, so that the moment of inertia can be obtained accurately and quickly under dynamic conditions. First, the electromagnetic and motion equation of the permanent magnet synchronous motor is built, and the logical relationship between the moment of inertia, torque, speed and other physical quantities is derived, so that the moment of inertia can be dynamically acquired. Second, in order to increase the identification accuracy, an adaptive function is introduced in the inertia identification model to replace the fixed parameters as an error gain factor (EGF). Third, the accuracy parameter is defined, and the identification algorithm on the basis of the EGF model is compared with the accuracy parameters of the existing identification method, which verifies that the improved algorithm has a better accuracy and speed. Finally, on the experimental platform, the working condition of unsteady speed is simulated. It is further verified that the proposed method has a high anti-interference capability.