4 title: "Mounting Keep as a filesystem"
7 This tutoral describes how to access Arvados collections using traditional filesystem tools by mounting Keep as a read-only file system using @arv-mount@.
9 {% include 'tutorial_expectations' %}
13 @arv-mount@ provides several features:
15 * You can browse, open and read Keep entries as if they are regular files.
16 * It is easy for existing tools to access files in Keep.
17 * Data is streamed on demand. It is not necessary to download an entire file or collection to start processing.
19 The default mode permits browsing any collection in Arvados as a subdirectory under the mount directory. To avoid having to fetch a potentially large list of all collections, collection directories only come into existence when explicitly accessed by their Keep locator. For instance, a collection may be found by its content hash in the @keep/by_id@ directory.
22 <pre><code>~$ <span class="userinput">mkdir -p keep</span>
23 ~$ <span class="userinput">arv-mount keep</span>
24 ~$ <span class="userinput">cd keep/by_id/c1bad4b39ca5a924e481008009d94e32+210</span>
25 ~/keep/by_id/c1bad4b39ca5a924e481008009d94e32+210$ <span class="userinput">ls</span>
26 var-GS000016015-ASM.tsv.bz2
27 ~/keep/by_id/c1bad4b39ca5a924e481008009d94e32+210$ <span class="userinput">md5sum var-GS000016015-ASM.tsv.bz2</span>
28 44b8ae3fde7a8a88d2f7ebd237625b4f var-GS000016015-ASM.tsv.bz2
29 ~/keep/by_id/c1bad4b39ca5a924e481008009d94e32+210$ <span class="userinput">cd ../..</span>
30 ~$ <span class="userinput">fusermount -u keep</span>
34 The last line unmounts Keep. Subdirectories will no longer be accessible.
36 Within each directory on Keep, there is a @.arvados#collection@ file that does not show up with @ls@. Its contents include, for instance, the @portable_data_hash@, which is the same as the Keep locator.
38 h3. Modifying files and directories in Keep
40 By default, all files in the Keep mount are read only. However, @arv-mount --read-write@ enables you to perform the following operations using normal Unix command line tools (@touch@, @mv@, @rm@, @mkdir@, @rmdir@) and your own programs using standard POSIX file system APIs:
42 * Create, update, rename and delete individual files within collections
43 * Create and delete subdirectories inside collections
44 * Move files and directories within and between collections
45 * Create and delete collections within a project (using @mkdir@ and @rmdir@ in a project directory)
49 * Symlinks, hard links
50 * Changing permissions
52 * Moving a subdirectory of a collection into a project, or moving a collection from a project into another collection
54 If multiple clients (separate instances of arv-mount or other arvados applications) modify the same file in the same collection within a short time interval, this may result in a conflict. In this case, the most recent commit wins, and the "loser" will be renamed to a conflict file in the form @name~YYYYMMDD-HHMMSS~conflict~@.
56 Please note this feature is in beta testing. In particular, the conflict mechanism is itself currently subject to race conditions with potential for data loss when a collection is being modified simultaneously by multiple clients. This issue will be resolved in future development.