ungleich-tools/ceph-osd-activate-all

25 lines
468 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)
2018-02-26 23:08:17 +00:00
for dev in $(fdisk -l | awk '$6 ~/Ceph OSD/ { 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"
/etc/init.d/ceph start "osd.$id"
done