Last active
May 6, 2021 17:14
-
-
Save alram/c891551ad56cfb907c80 to your computer and use it in GitHub Desktop.
Ceph journal migration
This file contains 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 | |
journal_device="/dev/sda" | |
osds=(0 1 2 3 4) | |
num_journal_part=${#osds[@]} | |
i=1 | |
while [ $i -le $num_journal_part ] | |
do | |
disk_id=`uuidgen` | |
sgdisk --new=${i}:0:+5120M --change-name="${i}:ceph journal" --partition-guid=${i}:${disk_id} --typecode=${i}:45b0969e-9b03-4f30-b4c6-b4b80ceff106 --mbrtogpt ${journal_device} | |
partx -a $journal_device | |
# old service ceph stop osd.${osds[$i-1]} | |
systemctl stop ceph-osd@${osds[$i-1]} | |
ceph-osd -i ${osds[$i-1]} --flush-journal | |
ln -sf /dev/disk/by-partuuid/${disk_id} /var/lib/ceph/osd/ceph-${osds[$i-1]}/journal | |
chown -h ceph:ceph /var/lib/ceph/osd/ceph-${osds[$i-1]}/journal | |
echo $disk_id > /var/lib/ceph/osd/ceph-${osds[$i-1]}/journal_uuid | |
ceph-osd -i ${osds[$i-1]} --mkjournal | |
# old service ceph start osd.${osds[$i-1]} | |
systemctl start ceph-osd@${osds[$i-1]} | |
i=$[$i+1] | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment