Last active
March 25, 2019 19:02
-
-
Save linuxkidd/f020708522fdd0a6cffebce67195a443 to your computer and use it in GitHub Desktop.
Fixes the journal symlink and the partition type UUID for a give OSD path.
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 | |
| if [ -z "$1" ]; then | |
| echo Please provide OSD path | |
| echo | |
| echo Usage Example: | |
| echo ./$0 /var/lib/ceph/osd/ceph-123 | |
| echo | |
| exit 1 | |
| fi | |
| osdpath=$1 | |
| if [ ! -L ${osdpath}/journal ]; then | |
| echo No journal link exists in $1 | |
| echo | |
| echo Usage Example: | |
| echo ./$0 /var/lib/ceph/osd/ceph-123 | |
| echo | |
| exit 1 | |
| fi | |
| myosdid=$(echo $osdpath | awk -F\- '{print $NF}') | |
| journallink=$(ls -l ${osdpath}/journal | awk '{print $NF}') | |
| journalpath=$(readlink -f ${osdpath}/journal) | |
| if [ $(echo $journallink | grep -c by-partuuid) -eq 0 ]; then | |
| journaluuid=$(blkid $journalpath -o value -s PARTUUID) | |
| echo Createing proper symlink to UUID $journaluuid | |
| rm -f ${osdpath}/journal | |
| ln -s /dev/disk/by-partuuid/${journaluuid} ${osdpath}/journal | |
| echo ${journaluuid} > ${osdpath}/journal_uuid | |
| else | |
| echo Journal already linked to partuuid. | |
| fi | |
| sgdisk --typecode=${journalpath: -1}:45b0969e-9b03-4f30-b4c6-b4b80ceff106 -- ${journalpath%?} |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run with the full OSD path to fix the journal. To run on all OSD paths, you could run as:
for i in /var/lib/ceph/osd/*; do ./fix-osd-journal.sh $i; done