Created
July 29, 2020 16:45
-
-
Save blemmenes/e12a4af3bbb14b2c68c06be421f894bb to your computer and use it in GitHub Desktop.
bash script to repair PGs
This file contains 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