In this paper an algorithm is introduced to use the ground cosmic ray data to prealct great geomagnetic storms. The muon measurement data from Nagoya station, Japan, was employed and the characters of cosmic ray evolvement before geomagnetic storm were revealed by analyzing the differences between the data just before the geomagnetic storms and the quiet days. It was found that fluctuations before geomagnetic storms increased due to the approaching of CME because the shock front and strong IMF induced by CME. An index to measure the fluctuation of data, Ds(t), was used in the cosmic ray data processing. The result shows that Ds(t) always increases monotonously several hours ahead the geomagnetic storm, which hopefully could become a useful factor for geomagnetic storm prediction. As it had been known that most of the large geomagnetic storms were caused by CMEs accompanying the Solar Proton Events (SPEs), the SPEs were also chosen together with Ds(t) in the prediction process. The mentioned algorithm was tested with the relative data of whole year 2001. The result turned out to be encouraging with the accuracy rate reach to 80% (8 out of 10) and false rate less than 18% (2 out of 11).