= Using the dCache SRM client = dCache provides a [wiki:manuals/dCache_clients/client_list series of clients] one of which is the srm client which supports a large number operations, but is just one Java application, the script name is sent to the Java applications command line to invoke each operation. This page just shows the scripts command line and not the invocation of the Java application directly. === Getting the dCache Version === the srmping command will tell you the backend version of dCache but only when you are authorized not just when you are authenticated. {{{ [omsynge@lucan ~]$ srmping -2 -l srm://swords.desy.de:8443/pnfs WARNING: SRM_PATH is defined, which might cause a wrong version of srm client to be executed WARNING: SRM_PATH=/opt/d-cache/srm VersionInfo : v2.2 backend_type:dCache backend_version:production-1-9-1-11 }}} === Creating a new directory === Usage: srmmkdir [command line options] srmUrl Example: {{{ [user]$ srmmkdir srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam/myDir }}} === Removing files from dCache === Usage: srmrm [command line options] srmUrl [[srmUrl]...] {{{ [user]$ srmrm srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam/myDir/myFile }}} === Removing empty directories from dCache === It is allowed to remove only empty directories as well as trees of empty directories. Usage: srmrmdir [command line options] srmUrl Examples: {{{ [user]$ srmrmdir srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam/myDir }}} {{{ [user]$ srmrmdir -recursive=true srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam/myDir }}} == srmcp for SRM v1 == Usage: srmcp [command line options] source(s) destination or : srmcp [command line options] -copyjobfile === Copying files to dCache === {{{ [user]$ srmcp -webservice_protocol=http file://///etc/group srm://leoben.desy.de:8443/pnfs/desy.de/data/dteam/test_Srm.clinton.501.32050.20070907153055.0 }}} === Copying files from dCache === {{{ [user]$ srmcp -webservice_protocol=http srm://leoben.desy.de:8443/pnfs/desy.de/data/dteam/test_Srm.clinton.501.32050.20070907153055.0 file://///tmp/testfile1 -streams_num=1 }}} == srmcp for SRM v2.2 == === Space Tokens === Space tokens are only supported in dCache 1.8.0 and above. Space token support must be [wiki:manuals/SRM_2.2_Setup set up] and [wiki:manuals/SRM_2.2_Setup#ReservingSpacewiththeAdminInterface reserving space with the admin interface] is also documented in this wiki. ==== Space Token Listing ==== Usage:get-space-tokens [command line options] srmUrl Example surveying's the space tokens available in a directory. {{{ [user]$ srm-get-space-tokens srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam -srm_protocol_version=2 }}} A successful result: {{{ return status code : SRM_SUCCESS return status expl. : OK Space Reservation Tokens: 148241 148311 148317 28839 148253 148227 148229 148289 148231 148352 }}} Example of listing the space tokens for a SRM: {{{ [omsynge@clinton ~]$ srm-get-space-tokens srm://srm-devel.desy.de:8443 Space Reservation Tokens: 145614 145615 144248 144249 25099 145585 145607 28839 145589 }}} ==== Space Token Reservation ==== Usage: srm-reserve-space [command line options] srmUrl {{{ [user]$ srm-reserve-space -desired_size 2000 -srm_protocol_version=2 -retention_policy=REPLICA -access_latency=ONLINE -guaranteed_size 1024 -lifetime 36000 srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam }}} A successful result: {{{ Space token =144573 }}} A typical failure {{{ SRMClientV2 : srmStatusOfReserveSpaceRequest , contacting service httpg://steyr.desy.de:8443/srm/managerv2 status: code=SRM_NO_FREE_SPACE explanantion= at Thu Nov 08 15:29:44 CET 2007 state Failed : no space available lifetime = null access latency = ONLINE retention policy = REPLICA guaranteed size = null total size = 34 }}} Also you can get info for this space token (144573): {{{ [user]$ srm-get-space-metadata srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam -space_tokens=144573 }}} Possible result: {{{ Space Reservation with token=120047 owner:VoGroup=/dteam VoRole=NULL totalSize:1024 guaranteedSize:1024 unusedSize:1024 lifetimeAssigned:36000 lifetimeLeft:25071 accessLatency:ONLINE retentionPolicy:REPLICA }}} ==== Writing to a Space Token ==== Usage: srmcp [command line options] source(s) destination Examples: {{{ [user]$ srmcp -protocols=gsiftp -space_token=144573 file://///home/user/path/to/myFile srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam/myFile }}} {{{ [user]$ srmcp -protocols=gsiftp -space_token=144573 file://///home/user/path/to/myFile1 file://///home/user/path/to/myFile2 srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam }}} ==== Space Metadata ==== Allows users to establish the metadata available for the space. Please note that space attributes are bounded by the setup of the server. {{{ [omsynge@clinton ~]$srm-get-space-metadata srm://swords.desy.de:8443/pnfs/desy.de/data/dteam -space_tokens=120049 WARNING: SRM_PATH is defined, which might cause a wrong version of srm client to be executed WARNING: SRM_PATH=/opt/d-cache/srm Space Reservation with token=120049 owner:VoGroup=/dteam VoRole=NULL totalSize:1024 guaranteedSize:1024 unusedSize:1024 lifetimeAssigned:36000 lifetimeLeft:30204 accessLatency:ONLINE retentionPolicy:REPLICA }}} ==== Space Token Release ==== Removes a space token from the SRM. {{{ [omsynge@clinton ~]$ srm-release-space srm://steyr.desy.de:8443 -space_token=15 }}} == Listing a file in SRM == SRM 2.2 has a much richer set well defined set of file listing commands. Usage: srmls [command line options] srmUrl [[srmUrl]...] Example of using '''srmls''': {{{ [omsynge@clinton ~]$ srmls srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam/testdir -2 0 /pnfs/desy.de/data/dteam/testdir/ 31 /pnfs/desy.de/data/dteam/testdir/testFile1 31 /pnfs/desy.de/data/dteam/testdir/testFile2 31 /pnfs/desy.de/data/dteam/testdir/testFile3 31 /pnfs/desy.de/data/dteam/testdir/testFile4 31 /pnfs/desy.de/data/dteam/testdir/testFile5 }}} Example of using '''srmls -l''' :[[BR]] (Note: changes srm ls to long format mode may result in dramatic increase in execution time.) {{{ [omsynge@clinton ~]$ srmls -l srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam/testdir -2 0 /pnfs/desy.de/data/dteam/testdir/ storage type:PERMANENT retention policy:CUSTODIAL access latency:NEARLINE locality:NEARLINE locality: null UserPermission: uid=18118 PermissionsRWX GroupPermission: gid=2688 PermissionsRWX WorldPermission: RX created at:2007/10/31 16:16:32 modified at:2007/11/08 18:03:39 - Assigned lifetime (in seconds): -1 - Lifetime left (in seconds): -1 - Original SURL: /pnfs/desy.de/data/dteam/testdir - Status: null - Type: DIRECTORY 31 /pnfs/desy.de/data/dteam/testdir/testFile1 storage type:PERMANENT retention policy:CUSTODIAL access latency:NEARLINE locality:NEARLINE - Checksum value: 84d007af - Checksum type: adler32 UserPermission: uid=18118 PermissionsRW GroupPermission: gid=2688 PermissionsR WorldPermission: R created at:2007/11/08 15:47:13 modified at:2007/11/08 15:47:13 - Assigned lifetime (in seconds): -1 - Lifetime left (in seconds): -1 - Original SURL: /pnfs/desy.de/data/dteam/testdir/testFile1 - Status: null - Type: FILE }}} Remark: The maximum number of elements listed with srmls is set to 1000. [[BR]] If you have more than 1000 entries in your directory, please use the following parameters:[[BR]] -count= number of entries to report[[BR]] -offset= offset to start number of entries to report. The default value is 0.[[BR]] For example, if you list a directory (containing more than 1000 entries) without parameters above, you get the first 999 entries listed. Example: {{{ [user]$ srmls -count=3 srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam/testdir -srm_protocol_version=2 0 /pnfs/desy.de/data/dteam/testdir/ 31 /pnfs/desy.de/data/dteam/testdir/testFile1 31 /pnfs/desy.de/data/dteam/testdir/testFile2 31 /pnfs/desy.de/data/dteam/testdir/testFile3 }}} Example: {{{ [user]$ srmls -count=3 -offset=1 srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam/testdir -srm_protocol_version=2 0 /pnfs/desy.de/data/dteam/testdir/ 31 /pnfs/desy.de/data/dteam/testdir/testFile2 31 /pnfs/desy.de/data/dteam/testdir/testFile3 31 /pnfs/desy.de/data/dteam/testdir/testFile4 }}} Example: {{{ [user]$ srmls srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam/dir1 srm://srm-devel.desy.de:8443/pnfs/desy.de/data/dteam/dir2 0 /pnfs/desy.de/data/dteam/dir1/ 31 /pnfs/desy.de/data/dteam/dir1/myFile1 28 /pnfs/desy.de/data/dteam/dir1/myFile2 47 /pnfs/desy.de/data/dteam/dir1/myFile3 0 /pnfs/desy.de/data/dteam/dir2/ 25 /pnfs/desy.de/data/dteam/dir2/fileA 59 /pnfs/desy.de/data/dteam/dir2/fileB }}} Last Modified by Owen @ 2008/10/13 Last Modified by Irina @ 2008/12/01 Last Modified by Owen @ 2009/02/13