Skip to content

Instantly share code, notes, and snippets.

@mnaser
Created February 8, 2023 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnaser/0c39a2ee875c37d9461430d94c4e6ff1 to your computer and use it in GitHub Desktop.
Save mnaser/0c39a2ee875c37d9461430d94c4e6ff1 to your computer and use it in GitHub Desktop.
Trim all `dups`
#!/bin/bash -xe
OSD_ID=${1}
# Turn off the OSD
systemctl stop ceph-osd@${OSD_ID}
# Loop over all placement groups
for PG in $(ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-${OSD_ID}/ --op list-pgs); do
ceph-objectstore-tool \
--data-path /var/lib/ceph/osd/ceph-${OSD_ID}/ \
--op trim-pg-log-dups \
--pgid ${PG} \
--osd_max_pg_log_entries=100 \
--osd_pg_log_dups_tracked=100 \
--osd_pg_log_trim_max=500000
done
# Start the OSD again
systemctl start ceph-osd@$OSD_ID
@mnaser
Copy link
Author

mnaser commented Feb 8, 2023

You can run this on systems by doing this:

curl -sL https://gist.github.com/mnaser/0c39a2ee875c37d9461430d94c4e6ff1/raw/0c088cfb4e398bb0897e2765d5be93db6feebe43/trim-osd-dups.sh | /bin/bash -xes 60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment