Shared Storage - Access - Linux

Prerequisites

The following information from the Self-Service Portal (SSP):


 

Accessing a Shared Storage with SMB Share

  1. Install the package cifs-utils

  2. Create a file with your login credentials:

  1. Replace <tud-login> and <tud-password> with your credentials.
    The path to this file is referenced as <credentials> in all following examples. This path must always be specified as an absolute file path.
  1. Mount the Shared Storage with the following command

    sudo mount -t cifs //<svm>.zih.tu-dresden.de/<name> <path> -o credentials=<credentials>
    Replace <svm>, <name> and <credentials> with your respective values. <path> is any target folder on the local system.
    Before mounting, note the additional options under Local Access Control
  2. (Optional) Persistent mount in /etc/fstab

    //<svm>.zih.tu-dresden.de/<name>  <path>  cifs  credentials=<credentials>,_netdev,nofail,x-systemd.automount  0  0
    We recommend the options _netdev,nofail,x-systemd.automount so that the system does not hang if the Shared Storage is unavailable.

 

Local Access Control

The possibilities described above for mounting a Shared Storage only allow access with root by default, because CIFS mounts without additional options locally belong to the root user.

To completely disable local access restrictions, the option noperm can be used. This gives EVERY local user access to the mounted filesystem:

sudo mount -t cifs //<svm>.zih.tu-dresden.de/<name> <path> -o credentials=<credentials>,noperm

To grant access to a specific user or group, the options uid and/or gid must be set accordingly. This assigns the mounted filesystem to that user or group. The options file_mode and dir_mode set the access permissions (0660 and 0770 are typical here):

sudo mount -t cifs //<svm>.zih.tu-dresden.de/<name> <path> -o credentials=<credentials>,uid=service,gid=service,file_mode=0660,dir_mode=0770

 

Accessing a Shared Storage with NFS Share

Direct Access

Prerequisites for direct access

 

Setup

  1. Mount the Shared Storage with the following command

    sudo mount -t nfs <svm>.zih.tu-dresden.de:/<name> <path> -o vers=3
    Replace <svm> and <name> with your respective values. <path> is any target folder on the local system.
    The option vers=3 mounts the Shared Storage with NFS version 3. Other available versions are 4, 4.1 and 4.2.
  2. (Optional) Persistent mount in /etc/fstab

    <svm>.zih.tu-dresden.de:/<name>   <path>   nfs   vers=3,_netdev,nofail,x-systemd.automount   0  0
    We recommend the options _netdev,nofail,x-systemd.automount so that the system does not hang if the Shared Storage is unavailable.

 

Access via Datagateway

Shared Storages with NFS shares can also be accessed via the Datagateway.

Detailed information and specific notes (such as access paths) can be found in the Datagateway article.

In the following examples, the TUD user fooba705g accesses the Shared Storage huawei_test_laufwerk_nfs (SVM vs-grp109) on the Datagateway.

 

Graphical Access with FileZilla

For access with a graphical interface, we recommend the program FileZilla. A guide can be found in the Datagateway - Access with FileZilla article.

 

Example with scp

$ scp fooba705g@dgw.zih.tu-dresden.de:/svm/vs-grp109/huawei_test_laufwerk_nfs/hello.txt .   

$ cat hello.txt

Hello World

 

Example with sshfs

Recommendation: SSHFS is more prone to errors due to the detour via the Datagateway. We recommend mounting directly with NFS or SMB.
$ mkdir test

$ sshfs fooba705g@dgw.zih.tu-dresden.de:/svm/vs-grp109/huawei_test_laufwerk_nfs/ test

$ ls test

bar  bat.txt  blabla.txt  foo/  hello.txt

Persistent sshfs mount:

  1. Register an SSH public key in the user’s authorized_keys file on the Datagateway. See Datagateway.

  2. (Optional) Test the connection via the command from Example with sshfs. There should be no password prompt.

  3. Create the entry in /etc/fstab

    sshfs#<tud-login>@dgw.zih.tu-dresden.de:/svm/<svm>/<name> <path> fuse _netdev,noauto,x-systemd.automount,x-systemd.idle-timeout=60,rw,allow_other,reconnect,uid=1000,gid=1000,IdentityFile=<private-key> 0 0
    Replace <tud-login>, <svm> and <name> with your respective values. <path> is any target folder on the local system.
    The option <private-key> must be replaced by the absolute path to the private key whose public key you registered.
    Adjust the remaining options as necessary. Also note the allow_other option (see also /etc/fuse.conf, which requires modification).
  4. Mount the drive

    sudo systemctl daemon-reload
    
    sudo mount <path>

 

Example with sftp

$ sftp fooba705g@dgw.zih.tu-dresden.de:/svm/vs-grp109/huawei_test_laufwerk_nfs

Connected to dgw.zih.tu-dresden.de.

Changing to: /svm/vs-grp109/huawei_test_laufwerk_nfs

sftp> dir

bar         bat.txt     blabla.txt  foo         hello.txt 

 

Example with rsync

rsync -avz fooba705g@dgw.zih.tu-dresden.de:/svm/vs-grp109/huawei_test_laufwerk_nfs/ ./local_folder/