GridStorageAccess

From T2B Wiki
Revision as of 08:38, 24 November 2022 by Admin (talk | contribs) (→‎gfal-commands)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


This page describes how to handle data stored on our mass storage system.

Introduction

T2B has an ever increasing amount of mass storage available. This system hosts both the centrally produced datasets as well as the user produced data.
The mass storage is managed by a software called dCache. As this software is in full development, new features are added continuously. This page contains an overview of the most used features of the software.

General info

As dCache was designed for precious data, the files are immutable. This means that once they are written, they cannot be changed any more. So, if you want to make changes to a file on dCache, you need to first erase it and then write it anew. Our dCache instance is mounted on all the M machines and can be browsed via the /pnfs directory. If you want to find your personal directory, the structure is the following:

/pnfs/iihe/<Experiment>/store/user/<Username>     <-- Replace <Username> and <Experiment> accordingly.

On the M machines as well as the whole cluster, /pnfs is mounted read-write via a protocol called 'nfs'. Please be aware that you can now inadvertently remove a large portion of your files. As it is a mass storage system, you can easily delete several TBs of data.

Writing and deleting files can still be done via via grid enable commands (see next section). These should still provide the best read/write speeds, compared to nfs access. These commands are mostly done via scripts, so the probability of an error is lessened.

Before starting

In what follows, most of the commands will require some type of authentication to access /pnfs. This is because these commands can be executed over WAN and your location is irrelevant.
The way authentication is done on our mass storage instance is via an x509 proxy. This proxy is made through your grid certificate. If you do not have a grid certificate, see this page on how to get one.
The command to make a grid proxy is:

voms-proxy-init --voms <MYEXPERIMENT>

Where <MYEXPERIMENT> is one of 'cms, icecube, beapps'

Browser access

dCache now exposes files using the WebDav protocol. This means that the files are accessible to browse over https.
For this, you need to have your certificate in your browser (to import your .p12 certificate, google is your friend).
Then just point your browser to:

https://maite.iihe.ac.be:2880/pnfs/iihe/cms/store/user/

To be able to see and download your files.


dCache has an even more powerful web interface. It is called dCache View and can be accessed via:

https://maite.iihe.ac.be:3880/

Work is still in progress to make all actions work (12/2021).


Access via GFAL

GFAL is a wrapper around the latest grid commands. Learning to use it means that whatever middleware requires to be used in the future, you don't need to learn new commands (like srm, lcg, etc)

gfal-commands

If you want more information on the options that can be used, please use the man pages of gfal !

Here are all the commands that can be used:

  • gfal-ls: get information on a file
  • gfal-mkdir: remove a directory
  • gfal-rm: removes a file. To remove an entire directory, use -r
  • gfal-copy: copy files.



Usage

There are 2 types of file url:

  • Distant files: their url is of the type <protocol>://<name_of_server>:<port>/some/path, eg for IIHE:
davs://maite.iihe.ac.be:2880/pnfs/iihe/
  • Local files: their url is of the type file://path_of_the_file, eg for IIHE:
file:///user/$USER/MyFile.root

Be careful, the number of / is very -very- important

  • To get a list of all distant urls for all the Storage Elements, one can do:
lcg-infosites --is grid-bdii.desy.de --vo cms se 
or read more in the CERN EOS urls page.

Protocols

  • https/WebDavs [preferred] [try this one first]
gfal-ls davs://maite.iihe.ac.be:2880/pnfs/iihe/cms/store/user/
  • xrootd [preferred]
gfal-ls root://maite.iihe.ac.be:1094/pnfs/iihe/cms/store/user/
  • srm [deprecated]
gfal-ls srm://maite.iihe.ac.be:8443/pnfs/iihe/cms/store/user/
  • nfs {local-only | no-cert}
gfal-ls /pnfs/iihe/cms/store/user/
  • dcap {local-only | no-cert}
gfal-ls dcap://maite.iihe.ac.be/pnfs/iihe/cms/store/user

Examples

  • To list the contents of a directory /pnfs/iihe/cms :
 gfal-ls davs://maite.iihe.ac.be:2880/pnfs/iihe/cms 
  • To create a directory:
 gfal-mkdir davs://maite.iihe.ac.be:2880/pnfs/iihe/cms/store/user/$USER/NewDir 
  • copy file from local disk to remote server
 gfal-copy file:///user/$USER/MyFile.root davs://maite.iihe.ac.be:2880/pnfs/iihe/cms/store/user/$USER/ 
  • To copy a file from remote server to our Storage Element:
 gfal-copy gsiftp://eosuserftp.cern.ch/eos/user/r/rougny/Documents/desktop.ini davs://maite.iihe.ac.be:2880/pnfs/iihe/cms/store/user/rougny/ 
  • To delete a file on remote server
 gfal-rm srm://maite.iihe.ac.be:8443/pnfs/iihe/cms/store/user/$USER/MyFile.root 
  • To remove a directory and its entire content on remote server ?!? not working for now ?):
 gfal-rm -r srm://maite.iihe.ac.be:8443/pnfs/iihe/cms/store/user/$USER/NewDir 


Copy more than 1 file

Copy Directories

You can easily copy whole directories to/from our site using gfal commands.
It is usually must faster than using scp or rsync commands.

gfal-copy -r [--dry-run] gsiftp://eosuserftp.cern.ch/eos/user/r/rougny/Documents/ davs://maite.iihe.ac.be:2880/pnfs/iihe/cms/store/user/rougny/

The magic option is -r for recursive copying.
When you are sure you get what you want, remove the --dry-run option.

Note that by default, gfal-copy will not overwrite files already present at the destination. This means it is usually safe to run the command several times.
If you want to force the copy over files already there, add the -f option to your gfal-copy command.


Bulk copy from a list of files

There is an elegant way to run gfal-copy through several files. This is done using the --from-file option.

 gfal-copy -f [--dry-run] --from-file files.txt file://location/to/store/ 

where files.txt is a file where every line is a source like:

davs://maite.iihe.ac.be:2880/pnfs/iihe/cms/store/user/odevroed/eosTransfer-1.root
davs://maite.iihe.ac.be:2880/pnfs/iihe/cms/store/user/odevroed/eosTransfer-2.root
... 

Make some tests with one line in datafile and make sure the url is OK for both source and destination before running over several files.
When you are sure you get what you want, remove the --dry-run option.


WebFTS web interface

If you prefer using a web interface to copy files to/from our /pnfs, you can use CERN's WebFTS feature.
Not all experiments are allowed to use it, but you can always make a request to have it included.

Other ways to access the mass storage system

Read and copy access

As stated in the introduction, dCache is an immutable file system, therefore files cannot be changed once they are written. Files can be accessed from pnfs in several ways without the requirement of a grid certificate and grid tools.

  • Via the regular 'cp' command (prefer the rsync command below):
cp /pnfs/iihe/cms/store/user/odevroed/DQMfile_83_1_hF2.root /user/odevroed 
  • Via the regular 'rsync' command:
rsync -aP /pnfs/iihe/cms/store/user/odevroed/*.root /user/odevroed/
  • Via the dcache copy command (dccp):
dccp dcap://maite.iihe.ac.be/pnfs/iihe/cms/store/user/odevroed/DQMfile_83_1_hF2.root ./ 
  • To open files directly using root, use eg
root dcap://maite.iihe.ac.be/pnfs/iihe/some/file.root 
When reading out the root files, if is rather slow or it doesn't work at all, and nothing is wrong with the root file (e.g. in an interactive analysis mX machines) you can increase your dCache readahead buffer. Don't make the buffer larger than 50MB!
To enlarge the buffer set this in you environment:
For csh
setenv DCACHE_RAHEAD 1
setenv DCACHE_RA_BUFFER 50000000
For bash
export DCACHE_RAHEAD=true
export DCACHE_RA_BUFFER=50000000
  • Via the 'curl' command over https
Copy from /pnfs:
curl -L --cert $X509_USER_PROXY --key $X509_USER_PROXY --cacert $X509_USER_PROXY --capath $X509_CERT_DIR  -O https://maite.iihe.ac.be:2880/pnfs/iihe/cms/store/user/odevroed/testing_transfer
Copy to /pnfs:
curl -L --cert $X509_USER_PROXY --key $X509_USER_PROXY --cacert $X509_USER_PROXY --capath $X509_CERT_DIR  -T testing_transfer  https://maite.iihe.ac.be:2880/pnfs/iihe/cms/store/user/odevroed/testing_transfer_2
This is equivalent to issuing the gfal-cp command via the https protocol:
gfal-copy testing_transfer https://maite.iihe.ac.be:2880/pnfs/iihe/cms/store/user/odevroed/testing_transfer2