[[PageOutline(2-5, Table of Contents, floated)]] = S3QL Mount and Unmount = This is a pair of script to mount and unmount S3QL filesystems, they are used on [[Crin3]]. == mnt-s3ql == {{{ #!/bin/bash # this scipt is for mounting a s3 compatible bucket using s3ql # # the name of the storageqloud bucket and also # the local mount point under $MOUNT should match # mount directory MOUNT="/media" # s3ql server SERVER="s3c://s.qstack.advania.com:443" # check that the script is being run by root if [[ "$(id -u)" != "0" ]] ; then echo "You must run $0 as root or via sudo" exit 2 fi # check for bucket name / directory on standard input if [[ $1 ]]; then BUCKET=$1 elif [[ ! $1 ]]; then echo "Type the bucketname and then [ENTER]:" read bucket BUCKET=$bucket fi # if force is wanted for filesystem check if [[ $1 == "--force" ]]; then # file system check with force fsck.s3ql --force --batch ${SERVER}/${BUCKET} \ || echo "Force filesystem check of ${SERVER}/${BUCKET} failed" else # file system check fsck.s3ql --batch ${SERVER}/${BUCKET} \ || echo "Filesystem check of ${SERVER}/${BUCKET} failed" fi # mount the s3ql file system mount.s3ql --backend-options="dumb-copy" --allow-root \ ${SERVER}/${BUCKET} ${MOUNT}/${BUCKET} || \ echo "Mounting ${SERVER}/${BUCKET} on ${MOUNT}/${BUCKET} failed" exit 0 }}} == unmnt-s3ql == {{{ #!/bin/bash # this scipt is for unmounting a s3 compatible bucket using s3ql # mount directory MOUNT="/media" # s3ql server SERVER="s3c://s.qstack.advania.com:443" # check that the script is being run by root if [[ "$(id -u)" != "0" ]] ; then echo "You must run $0 as root or via sudo" exit 2 fi # check for bucket name / directory on standard input if [[ $1 ]]; then BUCKET=$1 elif [[ ! $1 ]]; then echo "Type the bucketname and then [ENTER]:" read bucket BUCKET=$bucket fi # if force is needed if [[ $1 == "--force" ]]; then fusermount -u -z ${MOUNT}/${BUCKET} killall -9 mount.s3ql # file system check with force fsck.s3ql --batch --force ${SERVER}/${BUCKET} else # unmount umount.s3ql ${MOUNT}/${BUCKET} # check the file system fsck.s3ql --batch ${SERVER}/${BUCKET} fi exit 0 }}}