Files
sailing-analytics/configuration/mongo_instance_setup/ephemeralvolume
T
Axel Uhl 53dedb204b added scripts for Mongo Replica Set management
Change-Id: Iea2a4806091bbe76344debad2dfa58c4a1a434b4
2019-07-29 18:42:03 +02:00

20 lines
689 B
Bash

#!/bin/bash
# Script to deploy on an instance that has an ephemeral volume as /dev/nvme0n1 (adjust env var PARTITION if different)
# Ensures the partition is xfs-formatted, any existing partition contents will be overwritten if formatted otherwise.
# An existing xfs partition will be left alone.
PARTITION=/dev/nvme0n1
if [ \! -e $PARTITION ]; then
PARTITION=/dev/xvdb
fi
FSTYPE=$(blkid -p $PARTITION -s TYPE -o value)
if [ "$FSTYPE" != "xfs" ]; then
echo FSTYPE was "$FSTYPE" but should have been xfs. Formatting $PARTITION...
mkfs.xfs -f $PARTITION
else
echo FSTYPE was "$FSTYPE" which is just right :-\)
fi
# mount the thing to /var/lib/mongo
mount $PARTITION /var/lib/mongo