[GFARM LOGO] documents > User's Manual > samba/gfarmfs-fuse

GfarmFS-FUSE + Samba

English | Japanese

Another solution: Gfarm syscall-hooking library + Samba is here

1. Summary

You can access to Gfarm filesystem via GfarmFS-FUSE via Samba from Windows.

Configurations

Softwares

2. Japanese Filename

See GfarmFS-FUSE + Samba in Japanese

3. Samba Configuration

Setting shares configuration in smb.conf. Adding [homes] or 'Path' in [Section Name] for publishing the mountpoint by GfarmFS-FUSE.
This mountpoint is ~/.../mountpoint or ~/mountpoint or 'Path'/.../mountpoint or 'Path'/mountpoint.

And, adding the Samba member corresponding to the unix user (for this purpose).

See Samba documentations about the details of Samba configurations.

4. FUSE Configuration

If you will access to GfarmFS-FUSE via Samba when FUSE version 2.3.0 (or later) is installed, you should set the following.

/etc/fuse.conf
user_allow_other

This setting is that normal users can use the options of -o allow_root and -o allow_other. (See README of FUSE)

5. Mount by GfarmFS-FUSE

Please check whether you can access to Gfarm with 'gfhost -l'. Run the 'gfarmfs' to mount on the Samba server.
(See documentations of Gfarm and GfarmFS-FUSE about these details.)

  $ gfarmfs [GfarmFS options] mountpoint [FUSE options]

This mountpoint must be published by Samba. (See section 3)

Attention

You shall not set '-o allow_other' of FUSE option. If '-o allow_other' is set, other normal users can access to your Gfarm environment via the mountpoint by your authority.

6. Access to Samba from Windows

You access to the Samba and you open the share folder and the mountpoint by gfarmfs. And, you can assign this share folder to a network drive.

7. Example of Samba Configuration and Application

This is an example that the mountpoint for gfarmfs is automatically mounted , if you connect to the share folder named 'Gfarm'.

[Gfarm]
  path = %H/samba-fuse
  exec = /usr/local/bin/gfarmfsmount.sh %P
  preexec close = Yes
  postexec = /usr/local/bin/gfarmfsumount.sh %P
  read only = no

gfarmfsmount.sh
#! /bin/sh

GFARMFS=/usr/local/bin/gfarmfs
USERNAME=`/usr/bin/whoami`
LOGFILE=/tmp/gfarmfs-$USERNAME.log

#ARCH="-a i686-FC3-linux"
ALLOWROOT="-o allow_root"

GREP=/bin/grep
DF=/bin/df
TAIL=/usr/bin/tail
DATE=/bin/date

# for fusermount
export PATH=$PATH:/usr/local/bin

#####
if [ $# -ne 1 ]; then
    echo "usage: `basename $0` MOUNTPOINT"
    exit 1
fi

if [ ! -f $LOGFILE ]; then
    touch $LOGFILE
    chmod 600 $LOGFILE
fi

DATE=`$DATE '+%Y%m%d-%H%M%S'`
MOUNTP=$1

($DF -t fuse $MOUNTP | $TAIL +2 | $GREP gfarmfs > /dev/null && \
    (echo $DATE MOUNT:ALREADY $MOUNTP) || \
    ($GFARMFS $ARCH -l -s $MOUNTP $ALLOWROOT && \
    echo $DATE MOUNT:SUCCESS $MOUNTP || ! echo $DATE MOUNT:FAIL $MOUNTP)
) >> $LOGFILE 2>&1

exit $?

gfarmfsumount.sh
#! /bin/sh

FUSERMOUNT=/usr/local/bin/fusermount

USERNAME=`/usr/bin/whoami`
LOGFILE=/tmp/gfarmfs-$USERNAME.log

DATE=/bin/date
SLEEP=/bin/sleep

#####
if [ $# -ne 1 ]; then
    echo "usage: `basename $0` MOUNTPOINT"
    exit 1
fi

if [ ! -f $LOGFILE ]; then
    touch $LOGFILE
    chmod 600 $LOGFILE
fi

DATE=`date '+%Y%m%d-%H%M%S'`
MOUNTP=$1

(cd /; $SLEEP 1;
    $FUSERMOUNT -u $MOUNTP && \
        echo $DATE UMOUNT:SUCCESS $MOUNTP || \
        echo $DATE UMOUNT:FAIL $MOUNTP
) >> $LOGFILE 2>&1 &

8. comment

If you have any question or comment, feel free to send email to datafarm@apgrid.org.


Grid Datafarm <datafarm@apgrid.org>