The invention relates to a single-layer and multi-layer micro-nano structure pattern sample tracking device and method. The device comprises an illumination module, a linear array CCD, a computer, a diaphragm, a beam splitter prism, an area array CCD, a laser, a light splitting element, an imaging lens, a reflector, a beam expander, an attenuation sheet, a 1/2 wave plate, a polarization splitting prism, a 1/4 wave plate and the like. The micro-nano structure pattern sample is placed on the displacement table, the surface of the micro-nano structure pattern sample is clearly imaged in the area array CCD through the coarse adjustment motor, the defocusing amount of the current position is obtained through laser spot diameter data collected by the linear array CCD, and the piezoelectric ceramic is controlled to automatically track in real time. The tiny change of the laser spot can be detected by using high-precision pixels in the linear array CCD, the laser spot is secondarily amplified through the objective lens and the imaging system, so that the change rate of the laser spot is increased, and the system sensitivity is high. According to the method, the out-of-focus distance is obtained by measuring the spot diameter at a high speed in real time through the linear array CCD instead of being judged through spot energy.