[GFARM LOGO] documents > User's Manual > samba

Mount Gfarm File System from Windows Machines

English | Japanese

1. Summary

Windows client can access to the Gfarm file system using gfarm2fs and Samba.

Configuration

Software

2. Japanese Filename

See Samba in Japanese

3. Samba Configuration - smb.conf

Specify the mount point of the Gfarm file system in [homes] or [Section Name]. SWAT helps to set up the configuration.
When each user mounts the Gfarm file systen on /tmp/gfarm/username, The following configuration exports the mount point via samba;
[Gfarm]
path = /tmp/gfarm/%u
create mask = 0644
read only = no

See Samba documentations about the details of Samba configurations.

4. FUSE Configuration

The FUSE version 2.3.0 (or later) requires the following setting.

/etc/fuse.conf
user_allow_other

This allows users to specify the -o allow_root or -o allow_other option.

5. Mount by Gfarm2fs

First, check whether you can access to Gfarm by 'gfdf' and 'gfhost -l'. If it is succeeded, mount the Gfarm file system by 'gfarm2fs' on the Samba server.

  $ gfarm2fs [Gfarm2FS options] mountpoint [FUSE options]

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

Attention

Do not specify '-o allow_other' for the FUSE options. It allows all users to access the Gfarm file system using *your* privilege.

6. Example of Samba Configuration and Application

This is an example that the mountpoint for the Gfarm is automatically mounted by gfarm2fs, when you connect to the 'Gfarm' shared folder. This assume ~/samba-fuse directory exists. The preexec script mounts the Gfarm file system on ~/samba-fuse automatically, and the postexec script umounts it.

This also assume the shared secret key is distributed correctly, or a valid proxy certificate exists on the samba machine.

[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/gfarm2fs
USERNAME=`/usr/bin/whoami`
LOGFILE=/tmp/gfarm2fs-$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 gfarm2fs > /dev/null && \
    (echo $DATE MOUNT:ALREADY $MOUNTP) || \
    ($GFARMFS $ARCH $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/gfarm2fs-$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 gfarmfs at gmail.com.


Gfarm File System