Skip to content

Commit d1cc878

Browse files
authored
Add files via upload
1 parent a1d71db commit d1cc878

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

osd_expand_db_ics.sh

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
usage() { # Help
2+
cat << EOF
3+
Usage:
4+
[-o] Encrypted OSDs to expand DBs. List separted by commas, i.e. 2,3,4,5.
5+
[-h] Displays this message
6+
EOF
7+
exit 0
8+
}
9+
10+
11+
while getopts ":o:h" OPTION; do
12+
case ${OPTION} in
13+
o)
14+
OSD_LIST_=${OPTARG}
15+
IFS=',' read -r -a OSD_LIST <<< "$OSD_LIST_"
16+
;;
17+
h)
18+
usage
19+
;;
20+
esac
21+
done
22+
23+
for i in "${!OSD_LIST[@]}"; do
24+
25+
OSD_ID=${OSD_LIST[i]}
26+
27+
CEPH_STATUS=$(ceph health --format json | jq -r '.status')
28+
while [ "$CEPH_STATUS" != "HEALTH_OK" ]; do
29+
echo "Warning: Cluster is not in HEALTH_OK state"
30+
sleep 2
31+
CEPH_STATUS=$(ceph health --format json | jq -r '.status')
32+
done
33+
34+
echo "Set noout flag"
35+
ceph osd set noout
36+
37+
echo "Stopping OSD.$OSD_ID"
38+
systemctl stop ceph-osd@$OSD_ID
39+
40+
echo "Expanding journal DB size"
41+
ceph-bluestore-tool bluefs-bdev-expand --path /var/lib/ceph/osd/ceph-$OSD_ID/
42+
43+
echo "Migrating data from block device to DB"
44+
ceph-bluestore-tool bluefs-bdev-migrate --path /var/lib/ceph/osd/ceph-$OSD_ID/ --devs-source /var/lib/ceph/osd/ceph-$OSD_ID/block --dev-target /var/lib/ceph/osd/ceph-$OSD_ID/block.db
45+
46+
echo "Starting OSD.$OSD_ID"
47+
48+
systemctl start ceph-osd@$OSD_ID
49+
echo "Unset noout"
50+
ceph osd unset noout
51+
52+
echo "Verify osd is back up before continuing"
53+
OSD_STATE=$(ceph osd tree --format json | jq --arg id "$OSD_ID" -r '.nodes[] | select(.id == ($id |tonumber)) | .status')
54+
55+
echo "OSD_STATE: $OSD_STATE"
56+
while [ "$OSD_STATE" != "up" ]; do
57+
echo "Warning: OSD.$OSD_ID is not UP yet. Waiting..."
58+
sleep 2
59+
OSD_STATE=$(ceph osd tree --format json | jq --arg id "$OSD_ID" -r '.nodes[] | select(.id == ($id |tonumber)) | .status')
60+
echo "OSD_STATE: $OSD_STATE"
61+
done
62+
done

0 commit comments

Comments
 (0)