Restore the metadata of a Ceph OSD node

Restore the metadata of a Ceph OSD node

You may need to restore the metadata of a Ceph OSD node after a failure. For example, if the primary disk fails or the data in the Ceph-related directories, such as /var/lib/ceph/, on the OSD node disappeared.

To restore the metadata of a Ceph OSD node:

  1. Verify that the Ceph OSD node is up and running and connected to the Salt Master node.

  2. Log in to the Ceph OSD node.

  3. Synchronize Salt modules and refresh Salt pillars:

    salt-call saltutil.sync_all
    salt-call saltutil.refresh_pillar
    
  4. Run the following Salt states:

    salt-call state.sls linux,openssh,salt,ntp,rsyslog
    
  5. Manually install Ceph packages:

    apt install ceph-osd -y
    
  6. Stop all ceph-osd services:

    systemctl stop ceph-osd@<num>
    
  7. Remove the following files from Ceph:

    rm -rf /etc/ceph/* /var/lib/ceph/*
    
  8. From the Ceph backup, copy the files from /etc/ceph/ and /var/lib/ceph to their original directories:

    cp -r /<path>/* /etc/ceph/
    cp -r /<path>/* /var/lib/ceph/
    
  9. Change the files ownership:

    chown -R ceph:ceph /var/lib/ceph/*
    
  10. Restart the services for all Ceph OSDs:

    systemctl restart ceph-osd@<osd_num>