Access Windows-file-shares with smbnetfs

On the login-nodes of our clusters we have installed smbnetfs, a utility to access data on Windows file-servers (netshare, zidshare, ...).

You can't use smbnetfs on the worker-nodes (i.e. in a job)! If you need to work with files on a Windows-file-share in a job you first have to copy them into a sub-directory of your scratch-folder on the login-node!

Preparations

If you want to use smbnetfs you have to make some preparations (only once per login-node) in order to create the necessary folders and the configuration file:

 mkdir -p ~/.smb ~/netfs; chmod 700 ~/.smb
 conf="$HOME/.smb/smbnetfs.conf"
 echo "auth \"zidshare.uibk.ac.at\" \"UIBK/$USER\" \"<password>\"" >> $conf
 echo 'host zidshare.uibk.ac.at visible=true' >> $conf
 chmod 600 $conf
Please replace <password> with the actual password you use for our general services!

If you want do change or extend the configuration (which is a simple text-file) you can of course also use an editor: e.g.

nano ~/.smb/smbnetfs.conf

You can e.g. add these two lines to get access to your Windows-Nethome (drive letter I:):

 auth "nethome.uibk.ac.at" "UIBK/<yourusername>" "<password>"
 host nethome.uibk.ac.at visible=true

Starting smbnetfs

For getting access to the files you have to run

 smbnetfs ~/netfs

After this you will see a directory structure in ~/netfs that looks similar to this (which is the output of tree -L 2 ~/netfs):

netfs
├── nethome.uibk.ac.at
│   ├── ~
│   ├── <yourusername>
│   └── home
└── zidshare.uibk.ac.at
    ├── share
    └── user

As you see there is a virtual sub-directory for every server you are using and every share within a server. In this particular example the "share" sub-folder of "zidshare.uibk.ac.at" contains the data that in Windows normally is visible in drive J: and "user" contains the data of K:. The Windows-drive I: is accessible in the subfolder "~" or "<yourusername>" of "nethome.uibk.ac.at".

To copy files to and from the network share you can simply use "local" copy commands. E.g.

cp -r ~/netfs/zidshare.uibk.ac.at/user/tmp/some/folder $SCRATCH/some/other/folder/

Stopping smbnetfs

The files and folders stay accessible until the login-node is rebooted or until you stop smbnetfs by running

 fusermount -u ~/netfs
Nach oben scrollen