The present invention relates to a method, device, terminal and medium for avoiding
data loss in a
peering process. Before an OSD in a down state in a placement group starts up and enters the
peering process, a historical epoch sequence is calculated, and by judging whether the historical epoch sequence contains an abandoned OSDmap version, it is determined whether data writing occurs in the placement group during the period of the historical epoch sequence, thereby avoiding the situation where data writing cannot be judged when data is written to the abandoned OSDmap version. The analyzed historical epoch sequence of data writing is not less than the actual situation, thereby avoiding
missing data writing of the placement group. When an OSD in the placement group that has data writing during the down state starts up and enters the
peering process, the status of the remaining OSDs in the placement group is detected. If the remaining OSDs are all in the down state, the peering process of the OSD is suspended, and the peering process is completed only after the remaining OSDs are started up, thereby avoiding
data loss caused by the OSD completing the peering process alone when data is written to the placement group during the down state.