Time-stamp: <2004-12-01 21:26:55 gokieli>

Hints & Tips for the Use of

CASTOR project CASTOR in DELPHI DELPHI Collaboration

What is CASTOR?

CASTOR is an implementation of a Managed Storage system, developed at CERN, which allows users to store and retrieve large files (please do not use it for files below ~20MB!). It presents you with a file name space, which means you can store and manage your own files. All DELPHI users have their own CASTOR home directory, with an associated environment variable
$CASTOR_HOME = /castor/cern.ch/user/u/username
There is a pool of tapes behind this name space, to which your files are copied. All the administrative details of tape names, file sequences etc. are dealt with by the CASTOR software.

Basic usage

Main CASTOR commands

CASTOR comes with its own set of commands ns*, with their man pages. A (non-exhaustive) list of commands is presented here:
- lists the contents of your CASTOR home directory. Option -l gives a long listing (like standard ls, also some other ls options are available - although not all).
- removes a CASTOR file. Options -R will remove a directory and everything below it.
- creates a subdirectory
- changes the file name
- changes mode bits of file/directory. Useful if you share a directory with your colleagues.

Good old rfcp transfers a file to CASTOR - but make sure that the file has Unix read permission for "others"! In case of doubt precede this command by chmod a+r myfile.

More information can be found on IT Castor pages. In particular you may want to see the User Guide.

Some simple tricks

Group files

If you want to give write permission for your CASTOR-files to other DELPHI people, you should create an CASTOR subdirectory with the -m option:
  nsmkdir -m 775 $CASTOR_HOME/groupfiles
All DELPHI people will be able to create (and delete!) files in this directory.
For more details: man nsmkdir.

Removing complete sub-directories

The support for wild-characters in Castor is on the list of things to come, but the time scale is yet unknown. So whenever you want to remove a complete sub-directory from your Castor structure, the easiest way is to use the yes command:
  yes | nsrm $CASTOR_HOME/subdir

Emulating the wild-characters usage

If you want to list or delete only files of a specific kind, the lack of wild characters is sometimes sorely felt. The easiest way around is to use the combination of foreach and grep commands. Suppose you want to remove all your files with extension hbk - something you would like to do with a command
nsrm $CASTOR_HOME/subdir/*.hbk:
  foreach i ( `nsls $CASTOR_HOME/subdir | grep '[.]hbk$'` )
  nsrm $CASTOR_HOME/subdir/$i
(please note two kinds of quotes being used).
In a similar manner some very complicated selections can be imposed.
If you never used foreach: you type first line as is, and after a brief moment the machine will prompt you for the following lines. After typing end and its carriage-return sign, the execution starts immediately. It may take quite a while, if there are many files.

Copying CASTOR-files to/from non-CERN machines

Some known problems
(should disappear in the future CASTOR versions)

Please note that CASTOR is a complex system, developing very rapidly. The recommendations made on this page reflect our knowledge, but it may well be that users will run into problems that we have not realized. Please give us feedback!

As always, questions, complaints, remarks:
Jan van Eldik, Dec 6,2000
R.Gokieli, Nov 2, 2001