env vars: size, label; volumes as hdds

This commit is contained in:
Karol Majek
2018-11-29 14:41:08 +01:00
parent adc3330076
commit f56ab1a6e0
18 changed files with 208 additions and 322 deletions

View File

@@ -1,29 +1,32 @@
#!/bin/bash
cp /etc/mfs/mfschunkserver.cfg.sample /etc/mfs/mfschunkserver.cfg
mkdir -p /mnt/sdb1
chmod -R 777 /mnt/sdb1
echo "/mnt/sdb1 10GiB" >> /etc/mfs/mfshdd.cfg
mkdir -p /mnt/hdd0
chmod -R 777 /mnt/hdd0
chown -R mfs:mfs /mnt/hdd0
ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'
#Default size if not set
SIZE="${SIZE:- 10}"
echo "/mnt/hdd0 "$SIZE"GiB" >> /etc/mfs/mfshdd.cfg
echo "LABELS=$LABELS" >> /etc/mfs/mfschunkserver.cfg
sed -i '/# LABELS =/c\LABELS = DOCKER' /etc/mfs/mfschunkserver.cfg
sed -i '/MFSCHUNKSERVER_ENABLE=false/c\MFSCHUNKSERVER_ENABLE=true' /etc/default/moosefs-chunkserver
mfschunkserver start
# wait for mfsmaster startup
ping -c 10 mfsmaster
mkdir -p /mnt/mfs
mkdir -p /mnt/moosefs
# mount mfs
mfsmount /mnt/mfs -H mfsmaster
mfsmount /mnt/moosefs -H mfsmaster
# create example file to MooseFS
echo "If you can find this file in /mnt/mfs/SUCCESS on your client instance it means MooseFS is working correctly, congratulations!" > /mnt/mfs/welcome_to_moosefs.txt
echo "If you can find this file in /mnt/moosefs/welcome_to_moosefs.txt on your client instance it means MooseFS is working correctly, congratulations!" > /mnt/moosefs/welcome_to_moosefs.txt
# list files in MooseFS
ls /mnt/mfs/
ls /mnt/moosefs/
tree /mnt/moosefs/
if [[ $1 == "-d" ]]; then
while true; do sleep 1000; done