Time-stamp: <2004-12-01 21:26:55 gokieli>
Hints & Tips for the Use of
CASTOR in DELPHI
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:
- nsls
- - 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).
- nsrm
- - removes a CASTOR file.
Options -R will remove a directory and everything below it.
- nsmkdir
- - creates a subdirectory
- nsrename
- - changes the file name
- nschmod
- - 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
end
(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
-
For not too big amounts of data, and specially for files from your CASTOR
home directory (where no other method is possible), the simplest way is to
use temporary files in the /tmp directory on a CERN machine and the
scp command locally on your home machine. If you use the public
cluster at CERN (like LXPLUS), you will have to remember on which
particular machine you stored your file!
-
Login to the CERN machine and store your file in /tmp (we
will suppose that in the first step below you connected to
lxplus013)
- ssh lxplus.cern.ch
- rfcp ${CASTOR_HOME}/myfile /tmp/myfile
-
Once your files has been read from CASTOR, in another window on your
home machine initiate the transfer
- scp -pv myuserid@lxplus013.cern.ch:/tmp/myfile /local/myfile
-
When the transfer finished, on the CERN machine delete the temporary
file and possibly do the same operation with the next file to be
transferred.
-
Please note that:
-
You should rather avoid using AFS (like $SCRATCH or
$SCRATCH_WEEK areas) for temporary storage - whenever
possible, use a local file (like /tmp): AFS often has
very serious problems with handling big files, and this can even
lead to the AFS server crash!
-
You must take care not to fill the /tmp area completely,
because this may very likely crash your host, or else your files
may be removed by the system clean-up: after ~50% of /tmp
being used (command df -h /tmp), transfer the files and
remove them from /tmp.
-
In the scp command above you may use the wild-characters for the
remote files, but they must be enclosed in double-quotes:
- scp -pv myuserid@lxplus013.cern.ch:/tmp/myfile"*" /localdir/
The rfcp command does not accept any wild-characters
(see however the previous chapter on a trick that emulates them).
-
For big amounts of data from /castor/cern.ch/delphi/ CASTOR
directory, you will probably have to use the new service,
GridFTP.
Please see the
IT prepared documentation for details. Please note that for the
authorisation for transferring the DELPHI data you should write
directly to CERN
(see the list of bodies issuing the certificates),
and not to your country representative (which will give the
authorisation for the LHC-connected activities).
Some known problems
(should disappear in the future CASTOR versions)
-
At present CASTOR files (and specially those newly created!) should have
world read permission (022 for user's mask) in order to be
correctly handled by the CASTOR (and stager) software. This limitation will
be removed soon, but today it is imperative to comply. Anyway, with your
home directory being on AFS, there is reason to have such protection at all!
Please do not change the default value!
-
Do not use the shortcuts like
${CASTOR_HOME}/../../p/pubxx when you want to stage
other people's CASTOR files. Resolving this kind of names
confuses the stager!
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:
delphi-core@cern.ch
Jan van Eldik, Dec 6,2000
R.Gokieli, Nov 2, 2001