Oscar's notes on CASTOR storage

THIS IS OBSOLETE: USE EOS or CAF-T2 INSTEAD

This describes the basic commands to use CASTOR storage at CERN.

Basic handling of files

  • To list the content of a directory in CASTOR:
             rfdir /castor/cern.ch/user/o/oglez
    
  • To create a directory:
            rfmkdir /castor/cern.ch/user/o/oglez/hzz
    
    Since to transfer files from a GRID place to CASTOR requires that the destination location must be writable for ZH, we usually need to do after creating the directory:
           rfchmod 775  /castor/cern.ch/user/o/oglez/hzz
    
  • To copy a file to CASTOR:
          rfcp guia_ginebra.txt /castor/cern.ch/user/o/oglez/
    
  • To copy a file from CASTOR:
          rfcp guia_ginebra.txt /castor/cern.ch/user/o/oglez/
    
  • To delete a file in CASTOR:
          rfrm /castor/cern.ch/user/o/oglez/guia_ginebra.txt
    

  • To check whether a file is available on disk
          stager_qry -M /castor/cern.ch/user/o/oglez/guia_ginebra.txt
    
    which works on directories (when file ends in "/") and on recursive usage of the "-M" parameter.

  • To pre-stage a file into disk
          stager_get -M /castor/cern.ch/user/o/oglez/guia_ginebra.txt
    
    which again allows the usage of a recursive usage of the "-M" parameter.


  • Interacting with CASTOR and the GRID

    For copying files from a GRID place to CASTOR (beware that the destination must be writable for the group ZH) The GRID user, using the appropriate proxy should be able to copy a file using the standard lcg-cp command, but with more options due to the specifics of the access to CASTOR:
          lcg-cp -v -b -D srmv2 -n 5 \
              "srm://srm.ciemat.es:8443/srm/managerv2?SFN=/pnfs/ciemat.es/data/mydir/myfile" \
              "srm://srm-cms.cern.ch:8443/srm/managerv2?SFN=/castor/cern.ch/user/o/oglez/myfile"
    
    Since this operation from the T2-CIEMAT is expected to be very common using a list of files given by the DBS Discovery, I have made a command that makes the copy using such a list:
          $OGTAREAS_DIR/commands/grid/gridtocastor.sh list-files castor-dir [ciemat]
    
    For other sites we need to predefine the location. See the routine for checks.

    In any case we need to extract the correct SFN associated to the file, which is normally a prefix (site-dependence as srm://...) and the LFN (which is the standard /store/...).
    To obtain the LFN of a fils (and the corresponding prefix for a site), one should go to
           https://cmsweb.cern.ch/phedex/datasvc/xml/prod/lfn2pfn?node=MYSITE&lfn=MYLFN&protocol=srmv2
    
    where MYSITE is the name of the site (e.g. T2_ES_CIEMAT) and MYLFN is the LFN of the file.
    Again, some sites are already recognized by the script mentioned above.

    To send the output of a CRAB job to CASTOR, it is done as with usual Storage-Element (for which only the data files are sent there, not the log files).
    It is needed to have something like in the CRAB configuration file:
         [USER] 
         return_data = 0
         copy_data = 1
         storage_element=srm-cms.cern.ch
         storage_path=/srm/managerv2?SFN=/castor/cern.ch
         user_remote_dir=/user/o/oglez/...
    
    where, as always, the output directory should be writable by group ZH.


    CASTOR and ROOT files

  • Opening a ROOT file located in CASTOR:
          root rfio:/castor/cern.ch/user/o/oglez/...
    
  • Using a file in CASTOR inside a local CMS job:
          fileNames = cms.untracked.vstring("rfio:/castor/cern.ch/user/o/oglez/...")
    
    Although for "official" stuff stored in the /castor/cern.ch/cms/store/ area, the case is a bit simpler:
         fileNames = cms.untracked.vstring("/store/...")
    
  • It should be noted that given a full file name for a CMS dataset, it is only needed to add /castor/cern.ch/cms to the beginning to know where the file is located in CASTOR. Sometimes it is much more efficient than to wait for copying from a Tier 2.
    Also some datasets areon EOS and not in castor. The location there is starting with /eos/cms (and the filename).

    Comments about the web page: Oscar González