Skip to content

Instantly share code, notes, and snippets.

@hysios
Last active July 10, 2018 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hysios/2e271d2e681595774757c976ad5c7aea to your computer and use it in GitHub Desktop.
Save hysios/2e271d2e681595774757c976ad5c7aea to your computer and use it in GitHub Desktop.
UUID=$(uuidgen)
OSD_SECRET=$(ceph-authtool --gen-print-key)
NAME=centos_$HOSTNAME
DEV=/dev/mapper/$NAME-data
ID=$(echo "{\"cephx_secret\": \"$OSD_SECRET\"}" | \
ceph osd new $UUID -i - \
-n client.admin -k /etc/ceph/ceph.client.admin.keyring)
mkdir /var/lib/ceph/osd/ceph-$ID
umount /data
mkfs.xfs -K ${DEV} -f
mount $DEV /var/lib/ceph/osd/ceph-$ID
ceph-authtool --create-keyring /var/lib/ceph/osd/ceph-$ID/keyring \
--name osd.$ID --add-key $OSD_SECRET
ceph-osd -i $ID --mkfs --osd-uuid $UUID
chown -R ceph:ceph /var/lib/ceph/osd/ceph-$ID
systemctl enable ceph-osd@$ID
systemctl start ceph-osd@$ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment