Changes between Initial Version and Version 1 of S3QLMnt


Ignore:
Timestamp:
Jul 23, 2015, 2:58:55 PM (3 years ago)
Author:
chris
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • S3QLMnt

    v1 v1  
     1[[PageOutline(2-5, Table of Contents, floated)]]
     2
     3= S3QL Mount and Unmount =
     4
     5This is a pair of script to mount and unmount S3QL filesystems, they are used on [[Crin3]].
     6
     7== mnt-s3ql ==
     8
     9{{{
     10#!/bin/bash
     11
     12# this scipt is for mounting a s3 compatible bucket using s3ql
     13#
     14# the name of the storageqloud bucket and also
     15# the local mount point under $MOUNT should match
     16
     17# mount directory
     18MOUNT="/media"
     19
     20# s3ql server
     21SERVER="s3c://s.qstack.advania.com:443"
     22 
     23# check that the script is being run by root
     24if [[ "$(id -u)" != "0" ]] ; then
     25  echo "You must run $0 as root or via sudo"
     26  exit 2
     27fi
     28 
     29# check for bucket name / directory on standard input
     30if [[ $1 ]]; then
     31  BUCKET=$1
     32elif [[ ! $1 ]]; then
     33  echo "Type the bucketname and then [ENTER]:"
     34  read bucket
     35  BUCKET=$bucket
     36fi
     37 
     38# if force is wanted for filesystem check
     39if [[ $1 == "--force" ]]; then
     40  # file system check with force
     41  fsck.s3ql --force --batch ${SERVER}/${BUCKET} \
     42  || echo "Force filesystem check of ${SERVER}/${BUCKET} failed"
     43else
     44  # file system check
     45  fsck.s3ql --batch ${SERVER}/${BUCKET} \
     46  || echo "Filesystem check of ${SERVER}/${BUCKET} failed"
     47fi
     48
     49# mount the s3ql file system
     50mount.s3ql --backend-options="dumb-copy" --allow-root \
     51  ${SERVER}/${BUCKET} ${MOUNT}/${BUCKET} || \
     52  echo "Mounting ${SERVER}/${BUCKET} on ${MOUNT}/${BUCKET} failed"
     53
     54exit 0
     55}}}
     56
     57== unmnt-s3ql ==
     58
     59{{{
     60#!/bin/bash
     61
     62# this scipt is for unmounting a s3 compatible bucket using s3ql
     63
     64# mount directory
     65MOUNT="/media"
     66
     67# s3ql server
     68SERVER="s3c://s.qstack.advania.com:443"
     69
     70# check that the script is being run by root
     71if [[ "$(id -u)" != "0" ]] ; then
     72  echo "You must run $0 as root or via sudo"
     73  exit 2
     74fi
     75
     76# check for bucket name / directory on standard input
     77if [[ $1 ]]; then
     78  BUCKET=$1
     79elif [[ ! $1 ]]; then
     80  echo "Type the bucketname and then [ENTER]:"
     81  read bucket
     82  BUCKET=$bucket
     83fi
     84
     85# if force is needed
     86if [[ $1 == "--force" ]]; then
     87  fusermount -u -z ${MOUNT}/${BUCKET}
     88  killall -9 mount.s3ql
     89  # file system check with force
     90  fsck.s3ql --batch --force ${SERVER}/${BUCKET}
     91else
     92  # unmount
     93  umount.s3ql ${MOUNT}/${BUCKET}
     94  # check the file system
     95  fsck.s3ql --batch ${SERVER}/${BUCKET}
     96fi
     97
     98exit 0
     99}}}