Created
August 5, 2025 11:58
-
-
Save AnatomicJC/bf3e27ca34b38e9931e9556008b706bb to your computer and use it in GitHub Desktop.
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
POOL="rbd" | |
# 1. Obtenir les ID des images actives | |
ACTIVE_IDS=$(rbd ls -p "$POOL" --format json | jq -r '.[]' | while read -r img; do | |
rbd info "$POOL/$img" --format json | jq -r '.block_name_prefix' | cut -d'.' -f2 | |
done) | |
# 2. Lister tous les objets du pool | |
rados -p "$POOL" ls > /tmp/all_rbd_objects.txt | |
# 3. Filtrer les objets data | |
grep "^rbd_data\." /tmp/all_rbd_objects.txt > /tmp/data_objects.txt | |
# 4. Vérifier chaque objet : appartient-il à une image active ? | |
echo "$ACTIVE_IDS" > /tmp/active_ids.txt | |
echo "🔍 Objets potentiellement orphelins :" | |
while read -r object; do | |
ID=$(echo "$object" | cut -d'.' -f2) | |
if ! grep -q "$ID" /tmp/active_ids.txt; then | |
echo "$object" | |
fi | |
done < /tmp/data_objects.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment