47 lines
1.2 KiB
Bash
Executable file
47 lines
1.2 KiB
Bash
Executable file
#!/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 / manual does not work atm:
|
|
# + grep ceph.block_device
|
|
# + sed -e s/.*ceph.osd_id=// -e s/,.*//
|
|
# + ceph-volume lvm activate --no-systemd 112
|
|
# --> UnboundLocalError: local variable 'tags' referenced before assignment
|
|
|
|
#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
|
|
|
|
# Activate all volumes in the OS
|
|
vgchange -ay
|
|
# Using this with a fake /bin/systemctl
|
|
ceph-volume lvm activate --all
|
|
|
|
rmdir "$tmpdir"
|