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

31 lines
594 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)
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
rmdir "$tmpdir"