ungleich-tools/ceph/ceph-osd-activate-all

38 lines
853 B
Text
Raw Normal View History

2018-02-20 18:07:33 +00:00
#!/bin/sh
# Nico Schottelius, 2018-02-20
# Copyright ungleich glarus ag
set -e
set -x
tmpdir=$(mktemp -d)
2021-04-19 14:51:45 +00:00
# XFS based partition scheme
for dev in $(fdisk -l | awk '$6 ~/Ceph/ { print $1 }'); do
2018-02-20 18:07:33 +00:00
mount "$dev" "$tmpdir"
id=$(cat "${tmpdir}/whoami")
2018-02-20 18:12:51 +00:00
# Chown the dev device to be accessible for ceph
2018-02-20 18:13:19 +00:00
chown ceph:ceph "${tmpdir}/block"
2018-02-20 18:12:51 +00:00
2018-02-20 18:07:33 +00:00
umount "$dev"
dir="/var/lib/ceph/osd/ceph-$id"
mkdir -p "$dir"
mount "$dev" "$dir"
2018-04-04 15:28:42 +00:00
if [ -e /etc/monit ]; then
2018-04-04 15:29:37 +00:00
/opt/ungleich-tools/monit-ceph-create-start "osd.$id"
2018-04-04 15:28:42 +00:00
else
/etc/init.d/ceph start "osd.$id"
fi
2018-02-20 18:07:33 +00:00
done
2018-03-04 17:41:18 +00:00
# LVM based
for osdid in $(lvs -o lv_tags | grep ceph.block_device| sed -e 's/.*ceph.osd_id=//' -e 's/,.*//'); do
ceph-volume lvm activate --no-systemd $osdid
/opt/ungleich-tools/monit-ceph-create-start "osd.$osdid"
done
2018-03-04 17:41:18 +00:00
rmdir "$tmpdir"