gfal client

This page includes the basic commands to use gfal. For an overview of storage clients, see Storage clients.

gFAL

Note

To run the examples below you need to have a valid proxy, see StartGridSession.

Mandatory environment settings:

$export LCG_GFAL_INFOSYS=bdii.grid.sara.nl:2170

Note

The examples below will work both with TURLs and SURLs.

Creating/listing

  • Listing directories on dCache:

    $gfal-ls -l gsiftp://gridftp.grid.sara.nl:2811/pnfs/grid.sara.nl/data/lsgrid/
    
  • Create a new directory on dCache:

    $gfal-mkdir gsiftp://gridftp.grid.sara.nl:2811/pnfs/grid.sara.nl/data/lsgrid/homer/newdir/
    

Transferring data

  • Copy file from dCache to local machine:

    $gfal-copy gsiftp://gridftp.grid.sara.nl:2811/pnfs/grid.sara.nl/data/lsgrid/homer/zap.tar file:///`pwd`/zap.tar
    
  • Copy file from local machine to dCache:

    $gfal-copy file:///`pwd`/zap.tar gsiftp://gridftp.grid.sara.nl:2811/pnfs/grid.sara.nl/data/lsgrid/homer/zap.tar
    

Recursive transfer

Recursive transfer of files is not supported with the gfal-copy command.

FIFO transfers

Using a fifo pipe allows you to tar/untar a file on the fly and use half of the space on the WN, e.g. tarring a directory and uploading the tarball to dCache would require 2x(directory size) space on the WN without a fifo.

  • Download a tar ball from dCache using fifo

INPUT_FIFO="GRID_input_fifo.tar"
mkfifo ${INPUT_FIFO}
tar -Bxf ${INPUT_FIFO} & TAR_PID=$!
gfal-copy gsiftp://gridftp.grid.sara.nl:2811/pnfs/grid.sara.nl/data/lsgrid/homer/zap.tar file:///${PWD}/${INPUT_FIFO} && wait ${TAR_PID}
  • Upload a tar ball to dCache using fifo

OUTPUT_FIFO="GRID_output_fifo.tar"
tar -Bcf ${OUTPUT_FIFO} ${PWD}/mydir/ & TAR_PID=$!
gfal-copy file:///${PWD}/${OUTPUT_FIFO} gsiftp://gridftp.grid.sara.nl:2811/pnfs/grid.sara.nl/data/lsgrid/homer/zap.tar && wait ${TAR_PID}

Removing data

  • Remove a file from dCache:

$gfal-rm gsiftp://gridftp.grid.sara.nl:2811/pnfs/grid.sara.nl/data/lsgrid/homer/zap.tar
  • Remove whole (non-empty) directory with all content from dCache:

$gfal-rm -r gsiftp://gridftp.grid.sara.nl:2811/pnfs/grid.sara.nl/data/lsgrid/homer/testdir/

Checksums

  • Get checksum for a file on dCache:

$gfal-sum gsiftp://gridftp.grid.sara.nl:2811/pnfs/grid.sara.nl/data/lsgrid/homer/zap.tar ADLER32

Locality

  • Get locality (ONLINE, NEARLINE) for a file on dCache:

$gfal-xattr gsiftp://gridftp.grid.sara.nl:2811/pnfs/grid.sara.nl/data/lsgrid/homer/zap.tar user.status