8784: Fix test for latest firefox.
[arvados.git] / doc / user / topics / keep.html.textile.liquid
1 ---
2 layout: default
3 navsection: userguide
4 title: "How Keep works"
5 ...
6
7 The Arvados distributed file system is called *Keep*.  Keep is a content-addressable file system.  This means that files are managed using special unique identifiers derived from the _contents_ of the file (specifically, the MD5 hash), rather than human-assigned file names.  This has a number of advantages:
8 * Files can be stored and replicated across a cluster of servers without requiring a central name server.
9 * Both the server and client systematically validate data integrity because the checksum is built into the identifier.
10 * Data duplication is minimized—two files with the same contents will have in the same identifier, and will not be stored twice.
11 * It avoids data race conditions, since an identifier always points to the same data.
12
13 In Keep, information is stored in *data blocks*.  Data blocks are normally between 1 byte and 64 megabytes in size.  If a file exceeds the maximum size of a single data block, the file will be split across multiple data blocks until the entire file can be stored.  These data blocks may be stored and replicated across multiple disks, servers, or clusters.  Each data block has its own identifier for the contents of that specific data block.
14
15 In order to reassemble the file, Keep stores a *collection* data block which lists in sequence the data blocks that make up the original file.  A collection data block may store the information for multiple files, including a directory structure.
16
17 In this example we will use @c1bad4b39ca5a924e481008009d94e32+210@, which we added to Keep in "how to upload data":{{ site.baseurl }}/user/tutorials/tutorial-keep.html.  First let us examine the contents of this collection using @arv keep get@:
18
19 <notextile>
20 <pre><code>~$ <span class="userinput">arv keep get c1bad4b39ca5a924e481008009d94e32+210</span>
21 . 204e43b8a1185621ca55a94839582e6f+67108864 b9677abbac956bd3e86b1deb28dfac03+67108864 fc15aff2a762b13f521baf042140acec+67108864 323d2a3ce20370c4ca1d3462a344f8fd+25885655 0:227212247:var-GS000016015-ASM.tsv.bz2
22 </code></pre>
23 </notextile>
24
25 The command @arv keep get@ fetches the contents of the collection @c1bad4b39ca5a924e481008009d94e32+210@.  In this example, this collection includes a single file @var-GS000016015-ASM.tsv.bz2@ which is 227212247 bytes long, and is stored using four sequential data blocks, @204e43b8a1185621ca55a94839582e6f+67108864@, @b9677abbac956bd3e86b1deb28dfac03+67108864@, @fc15aff2a762b13f521baf042140acec+67108864@, and @323d2a3ce20370c4ca1d3462a344f8fd+25885655@.
26
27 Let's use @arv keep get@ to download the first data block:
28
29 notextile. <pre><code>~$ <span class="userinput">cd /scratch/<b>you</b></span>
30 /scratch/<b>you</b>$ <span class="userinput">arv keep get 204e43b8a1185621ca55a94839582e6f+67108864 &gt; block1</span></code></pre>
31
32 {% include 'notebox_begin' %}
33
34 When you run this command, you may get this API warning:
35
36 notextile. <pre><code>WARNING:root:API lookup failed for collection 204e43b8a1185621ca55a94839582e6f+67108864 (&lt;class 'apiclient.errors.HttpError'&gt;: &lt;HttpError 404 when requesting https://qr1hi.arvadosapi.com/arvados/v1/collections/204e43b8a1185621ca55a94839582e6f%2B67108864?alt=json returned "Not Found"&gt;)</code></pre>
37
38 This happens because @arv keep get@ tries to find a collection with this identifier.  When that fails, it emits this warning, then looks for a datablock instead, which succeeds.
39
40 {% include 'notebox_end' %}
41
42 Let's look at the size and compute the MD5 hash of @block1@:
43
44 <notextile>
45 <pre><code>/scratch/<b>you</b>$ <span class="userinput">ls -l block1</span>
46 -rw-r--r-- 1 you group 67108864 Dec  9 20:14 block1
47 /scratch/<b>you</b>$ <span class="userinput">md5sum block1</span>
48 204e43b8a1185621ca55a94839582e6f  block1
49 </code></pre>
50 </notextile>
51
52 Notice that the block identifer <code>204e43b8a1185621ca55a94839582e6f+67108864</code> consists of:
53 * the MD5 hash of @block1@, @204e43b8a1185621ca55a94839582e6f@, plus
54 * the size of @block1@, @67108864@.