#!/bin/sh # Nico Schottelius, 2018-02-20 # Copyright ungleich glarus ag set -e set -x tmpdir=$(mktemp -d) # XFS based partition scheme for dev in $(fdisk -l | awk '$6 ~/Ceph/ { print $1 }'); do mount "$dev" "$tmpdir" id=$(cat "${tmpdir}/whoami") # Chown the dev device to be accessible for ceph chown ceph:ceph "${tmpdir}/block" umount "$dev" dir="/var/lib/ceph/osd/ceph-$id" mkdir -p "$dir" mount "$dev" "$dir" if [ -e /etc/monit ]; then /opt/ungleich-tools/monit-ceph-create-start "osd.$id" else /etc/init.d/ceph start "osd.$id" fi done # 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 rmdir "$tmpdir"