Cvmfs: Difference between revisions
Line 87: | Line 87: | ||
<pre>cd ~ | <pre>cd ~ | ||
cvmfs_server publish mu2e.opensciencegrid.org</pre> | cvmfs_server publish mu2e.opensciencegrid.org</pre> | ||
<li>to abort the transaction | <li><font color=red>to abort the transaction</font> | ||
<pre>cd ~ | <pre>cd ~ | ||
cvmfs_server abort mu2e.opensciencegrid.org</pre> | cvmfs_server abort mu2e.opensciencegrid.org</pre> |
Revision as of 22:03, 30 March 2017
Introduction
CERN Virtual Machine File System (CVMFS) is a distributed disk system for providing an experiment's code and libraries to interactive node and grids worldwide. It is used by CMS and Atlas and well as most experiments at FNAL.
The code manager copies a code release to a CVMFS work space and "publishes" it. This process examines the code, compresses it, and inserts it in a database. The original database is called the tier 0 copy. Large remote sites, such as grids, may support tier 1 copies of the database, synced to the tier 0. Small (university group) sites can connect to tier 0 directly.
The user's grid job sees a CVMFS disk mounted and containing a copy of the experiment's code, which can be accessed in any way the code would be accessed on a standard disk. The disk is actually a custom nfs server with a small ( ~8 GB) local cache on the node and a backend that sends file requests to a squid web cache. The squid may get its data from the tier 1 database, if available, or from the tier 0. As a practical matter, most grid jobs do not access much in a release, usually just a small set of shared object libraries, and these end up cached on the worker node, or on the squid, thereby avoiding a long-distance network transfer.
CVMFS is efficient only for distributing code and small data files which are required by a large number of nodes on the grid. On the other hand, datasets, such as event data files, consist of many large files which are each sent to only one node during a grid job. CVMFS is not efficient for this type of data distribution or for this sort of data volume. Data files should be distributed through dCache, which is designed to deliver each file to one node, and to handle the data volume. A single large file which is to be distributed to all nodes also need to be avoided since it would would churn or overflow the small local caches. Examples of this sort of file are the Genie flux files or a large analysis fit template library. The lab has developed a stashCache feature for CVMFS, to address this sort of file. The mu2e B-field files and stopped muon ntuples are distributed by CVMFS, but are about at the limit of file size that is appropriate.
The mu2e CVMFS partition is available on all grid sites that mu2e can submit to. The Fermigrid local farm and interactive nodes have the same setup, so you do not need to modify your script for onsite versus offsite. CVMFS is mounted on the mu2e interactive nodes, and is the default source for code and products.
Using CVMFS
Here is the recommended setup sequennce, which will work on interactive nodes and all grid jobs.
source /cvmfs/fermilab.opensciencegrid.org/products/common/etc/setups setup mu2e
Note that the source, in products/common, may already be done by the grid startup procedure. It doesn't create any known problem if it is sourced a second time.
The second method, which is not preferred, is to simply source the mu2e startup script:
source /cvmfs/mu2e.opensciencegrid.org/setupmu2e-art.sh
To setup a base release of the mu2e Offline code, after deciding the version (v5_2_2) the build (SLF6) and prof/debug:
source /cvmfs/mu2e.opensciencegrid.org/Offline/v5_2_2/SLF6/prof/Offline/setup.sh
To summarize:
source /cvmfs/fermilab.opensciencegrid.org/products/common/etc/setups setup mu2e source /cvmfs/mu2e.opensciencegrid.org/Offline/v5_2_2/SLF6/prof/Offline/setup.sh
These recipes assume you have not done any other setup actions, but even if you have, "setup mu2e" or its equivalent should force your PRODUCTS path to point to cvmfs, for mu2e and common products, no matter what.
Occasionally, on OSG remote sites, we can land on a node that knows of the latest version of cvmfs contents, but still returns the next-to-latest version of the contents for one minute. In order to avoid this (rare) case, you can run these commands before accessing cvmfs:
/cvmfs/grid.cern.ch/util/cvmfs-uptodate /cvmfs/fermilab.opensciencegrid.org /cvmfs/grid.cern.ch/util/cvmfs-uptodate /cvmfs/mu2e.opensciencegrid.org
Installing CVMFS
It is preferred that all mu2e sites use this as a local code disk.
If you have root access, it is straightforward to install a readonly CVMFS client on a remote linux system. For a small load (a few desktops), please use this recipe with
CVMFS_HTTP_PROXY=DIRECT CVMFS_REPOSITORIES="fermilab.opensciencegrid.org,mu2e.opensciencegrid.org"
For a large installation like a farm, you will need to use these instructions and investigate a local "squid" cache for CVMFS_HTTP_PROXY.
You can size your local cache so that everything you normally use will sit in the cache. Therefore you pay network latency only on the first use of any new ups product; on subsequent uses, the products are acessed from the cache. Therefore it is possible to work on your laptop even when it is not connected to a network.
There was a Jan 2017 discussion on hypernews about installing cvmfs on SL7.
Adding CVMFS content
These are the steps to copy code into the cvmfs repository, and publish it so that it goes out to all sites. Since only collaboration tagged releases and Fermilab static products are distributed this way, this procedure is only performed by the code manager.
Here is some background information on maintaining cvmfs and its limitations.
[CodeDistribution|Download instructions] is good for an overview of how to pull art products, DataFiles and setupmu2e-art.sh to a local disk, which is useful background information.
There are three categories of files that make up the content of mu2e environment and are copied to cvmfs.
- Base releases are built by hand or on Jenkins build server and installed on cvmfs. [
- The art product and all the products it depends on are distributed a set defined by a manifest. The manifests are listed on scisoft.fnal.gov. These will tell you the arguments to the pullProducts script below. We use relocatable ups products which can also be pulled individually from scisoft as tarballs.
- magnetic field maps and other special data files
- Note! G4beamline is not pulled with pullProdcuts, it is not a real product. You will need to copy that separately below.
- Note! If you have ups setup from anywhere while running pullProducts, it will not pull ups, even if it is on the manifest (unsetup ups to avoid this).
The most common procedure is to load a new tagged release, built on Jenkins, followed by updating a mu2e-maintianed product and then loading a whole new art product suite.
To publish files on the mu2e CVMFS server, your kerberos principal will need to be in the k5login for cvmfsmu2e on oasiscfs.fnal.gov. An offline manager can do this.
- NOTE!!!! do not "mv" any files or dirs, instead delete and recopy if necessary (it will hang). This is a bug in cvmfs as of 2/2015
All the recipes follow this pattern:
- login to the cvmfs server node (permission through the .k5login there)
ssh -X -l cvmfsmu2e oasiscfs.fnal.gov
- tell the cmfs server to record the changes you are about to make, and go to the write area
cvmfs_server transaction mu2e.opensciencegrid.org cd /cvmfs/mu2e.opensciencegrid.org
- maintain files, rsync, scp, pullProducts, wget, cp, find, rm etc. (do not mv!)
- must cd out of the data directory or the next step will fail! Finish the transaction and publish.
cd ~ cvmfs_server publish mu2e.opensciencegrid.org
- to abort the transaction
cd ~ cvmfs_server abort mu2e.opensciencegrid.org
Examples
All the examples will follow the above pattern for opening and publishing a cvmfs transaction. These examples only include the commands to move files.
Jenkins build
Here is an example of pulling a release built on Jenkins directly on the cvmfs host machine. This will try to copy SLF6 prof,debug
source /cvmfs/fermilab.opensciencegrid.org/products/common/etc/setups setup codetools REL=v5_5_1 cd /cvmfs/mu2e.opensciencegrid.org/Offline copyFromJenkins.sh $REL # delete the intermediate .os and other temp files cleanupRelease.sh $PWD/$REL/SLF6/prof/Offline cleanupRelease.sh $PWD/$REL/SLF6/debug/Offline
rsync
Here is an example of using rsync. In the rsync command, if the source is the name of a directory, and if the directory name contains a trailing slash, rsync interprets this to mean a wildcard of the directory contents, not the name of directory itself.
cd /cvmfs/mu2e.opensciencegrid.org rsync -aur rlc@mu2egpvm01:/mu2e/app/Offline/tmp/DataFiles . rsync -aur rlc@mu2egpvm01:/mu2e/app/Offline/tmp/setupmu2e-art.sh . rsync -aur rlc@mu2egpvm01:/grid/fermiapp/products/mu2e/artexternals/G4beamline artexternals
scisoft product
Here is an example of installing a single product from scisoft.fnal.gov/packages directly on the cvmfs host machine
cd /cvmfs/mu2e.opensciencegrid.org/artexternals wget http://scisoft.fnal.gov/scisoft/packages/geant4/v4_10_1_p02a/geant4-4.10.1.p02a-slf6-x86_64-e9-prof.tar.bz2 tar -xjf geant4-4.10.1.p02a-slf6-x86_64-e9-prof.tar.bz2 rm -f *.bz2
art manifest
Here is an example of pulling the products from an art manifest directly to the cvmfs host machine. Please see CodeDistribution or scisoft for a discussion of the flags for pullProducts.
cd /cvmfs/mu2e.opensciencegrid.org/artexternals ~/pullProducts $PWD slf6 mu-v1_17_02 s20-e9 prof rm -f *.bz2 *MANIFEST.txt
link release
Here is an example of creating a link release
cd /cvmfs/mu2e.opensciencegrid.org/OfflineSpecial mkdir -p v5_7_9-cosmic_target5-v3/SLF6/prof/Offline cd v5_7_9-cosmic_target5-v3/SLF6/prof/Offline find /cvmfs/mu2e.opensciencegrid.org/Offline/v5_7_9/SLF6/prof/Offline -maxdepth 1 | while read FF; do ln -s $FF; done rm JobControl mkdir JobControl cd JobControl find /cvmfs/mu2e.opensciencegrid.org/Offline/v5_7_9/SLF6/prof/Offline/JobControl -maxdepth 1 | while read FF; do ln -s $FF; done rm cd3 mkdir cd3 # continue with links and replacing with real files where needed # check that real files are there find /cvmfs/mu2e.opensciencegrid.org/OfflineSpecial/v5_7_9-cosmic_target5-v3 -type f
unbundled products
Here are some products which are pulled occasionally by hand because they are not part of the art suite and its manifest.
- allinea - a debugger
- historoot - needed for g4beamline
- artdaq - not clear if we need this
- mu2egrid - we only need the most recent version
- mpich - this is for testing with multithreading - used by Mike Wang in trigger studies - we need it.
- toyExperiment - take only the most recent version - used by art_workbook
- upd - probably should add this so that we can install from kits
- .updfiles - same
- valgrind - memory checker
Pulled by hand for G4Beamline:
- g4radiative v3_6
- g4photon v2_3
- root v5_28_00c
Notes
To see the size of the cvmfs cache on a node,
df -h /cvmfs/mu2e.opensciencegrid.org/
this is shared by all cvmfs partitions. Also useful is the config file:
cat /etc/cvmfs/default.local
which contains CVMFS_QUOTA_LIMIT, in MB. The actual cache is usually in /var/cache. mu2egpvm seems to have 8GB, grid nodes have 3.6GB.
The compressed database of files is under
/srv/cvmfs/mu2e.opensciencegrid.org
on oasiscfs.fnal.gov.
Guidelines on Usage
On September 6 2016, we asked Dave Dykstra for information about quotas and/or other usage guidelines. The short version of his reply is that we have a quota of about 191 GB on:
/srv/cvmfs/mu2e.opensciencegrid.org
and no quota (ie usage limited only by the free space on the file system) on:
/cvmfs/mu2e.opensciencegrid.org
Throughout this discussion 1 GB means 10243 bytes.
On Sep 6, 2016 the Mu2e quota on /srv/cvmfs/mu2e.opensciencegrid.org was doubled from 95 GB to 191 GB. This directory holds the de-duplicated and compressed database and is visible only on oasiscfs.fnal.gov. The partition that contains this directory also contains databases for other experiments and as of, Sept 6, 2016, the partition has about 4TB of which about 50% is used.
To check the Mu2e quota and the used fraction of the quota:
quota -s /srv/cvmfs/mu2e.opensciencegrid.org
and look for the information about:
/dev/mapper/vgData-srv_cvmfs
You can also check the usage on this disk using du -sh; its answer should agree with the answer given by quota. If necessary, we may ask for an increase in the quota.
On oasiscfs.fnal.gov the directory:
/cvmfs/mu2e.opensciencegrid.org
contains the source from which the the de-duplicated compresssed database is created. On other machines it is a cached image of that database. On oasiscfs.fnal.gov there is no Mu2e quota on this disk.
The following table gives the disk space used on /cvmfs/mu2e.opensciencegrid.org/ (Uncompressed) and /srv/cvmfs/mu2e.opensciencegrid.org (Compressed) at various times:
Date | Uncompressed (GB) | Compressed (GB) |
---|---|---|
Sep 3, 2015 | 80 | 32 |
Dec 20, 2015 | 144 | -- |
Sep 6, 2016 | 236 | 96 |
The ratio of compressed to uncompressed is roughly constant with time.
Some other details about the compressed and de-duplicated database: /srv/cvmfs/mu2e.opensciencegrid.org.
- The total space used by all experiments is 2.0 TB and there is 2.0 TB free.
- Another 4TB file system is available to handle overflow.
- NOvA is the big user with 880TB (on Sep 3, 2015; probably more now)
- If the present ratio of compressed to uncompressed remains unchanged, 191GB on the compressed de-duplicated database corresponds to about 500GB on the published repository.
Other factoids:
- The compressed and de-duplicated repository is what is copied to the stratum 1 servers. The owners of these servers prefer that usage on the servers does not grow "too fast"; at this time the BNL server is tight for space.
- Removing files from the publshed repo does not automatically recover space in the compressed and de-duplicated repo.
- Space is only recovered if a snapshot is taken, which is a manual process and only happens rarely.
- The snapshot process needs to be done at each stratum 1 server.
Hard links
In March 2017 on INC000000837206, we investigated this error:
...OverlayFS has copied-up a file (/cvmfs/mu2e.opensciencegrid.org/artexternals/root/v6_08_04e/Linux64bit+2.6-2.12-e10-prof/bin/genreflex) with existing hardlinks in lowerdir (linkcount 3). OverlayFS cannot handle hardlinks and would produce inconsistencies. > > Consider running this command: > cvmfs_server eliminate-hardlinks
On the node that uploads the file, oasiscfs.fnal.gov, the filesystem we are interacting with is actually OverlayFS. It used to be aufs, but when it changed to OverlayFS, this problem with hard links was introduced. We found hard links in gcc and root bin areas. You can fix this by aborting the transaction, writing the products on a local disk, then rsync (without -H which preserves hard link) to the upload area. The rsync will remove the hard link and replace with unique identical files. It you want to fix the problem in place on the upload disk, you have to delete both file hard-linked files and replace them. We are not sure if this is still a problem today. We asked that hard links be removed from products before being put on scisoft.