-
-
Save nohupped/7fad42b414333c62a573310c7fda35cb to your computer and use it in GitHub Desktop.
bash script to repair PGs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# from https://github.com/cernceph/ceph-scripts/blob/master/tools/scrubbing/autorepair.sh | |
for PG in $(ceph pg ls inconsistent -f json | jq -r .pg_stats[].pgid) | |
do | |
echo Checking inconsistent PG $PG | |
if ceph pg ls repair | grep -wq ${PG} | |
then | |
echo PG $PG is already repairing, skipping | |
continue | |
fi | |
# disable other scrubs | |
ceph osd set nodeep-scrub | |
ceph osd set noscrub | |
# bump up osd_max_scrubs | |
ACTING=$(ceph pg $PG query | jq -r .acting[]) | |
for OSD in $ACTING | |
do | |
ceph tell osd.${OSD} injectargs -- --osd_max_scrubs=3 --osd_scrub_during_recovery=true | |
done | |
ceph pg repair $PG | |
sleep 10 | |
for OSD in $ACTING | |
do | |
ceph tell osd.${OSD} injectargs -- --osd_max_scrubs=1 --osd_scrub_during_recovery=false | |
done | |
# disable other scrubs | |
ceph osd unset nodeep-scrub | |
ceph osd unset noscrub | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment