Created
January 12, 2017 22:35
-
-
Save wolsen/1a9f44f1aee98c6a8cce8ecb95eb10b5 to your computer and use it in GitHub Desktop.
Re-creates external journals for Ceph OSDs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
stop ceph-osd-all | |
part_num=0 | |
journal_disk=/dev/vdb | |
jsize=512M | |
osds="1 2" | |
for i in $osds | |
do | |
ceph-osd -i $i --flush-journal | |
done | |
sgdisk --zap-all $journal_disk | |
parted $journal_disk mklabel gpt | |
for i in $osds | |
do | |
echo "Creating journal partition for ceph-$i" | |
part_num=$(($part_num + 1)) | |
if [ ! -f /var/lib/ceph/osd/ceph-$i/journal_uuid ]; then | |
echo "generating new uuid at /var/lib/ceph/osd/ceph-$i/journal_uuid" | |
uuidgen > /var/lib/ceph/osd/ceph-$i/journal_uuid | |
fi | |
journal_uuid=$(cat /var/lib/ceph/osd/ceph-$i/journal_uuid) | |
echo "journal_uuid=$journal_uuid" | |
sgdisk --new=$part_num:0:+$jsize --change-name=$part_num:'ceph journal' --partition-guid=$part_num:$journal_uuid --typecode=0:$journal_uuid --mbrtogpt -- $journal_disk | |
# Use the updated partition id | |
ln -sf /dev/disk/by-partuuid/$journal_uuid /var/lib/ceph/osd/ceph-$i/journal | |
sleep 5 | |
ceph-osd -i $i --mkjournal | |
start ceph-osd id=$i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment