# Shared drives

Groups that share packages across users can save storage and network traffic by installing packages from a shared directory (e.g. on a network file server).

## Create and populate shared package directory

1. Create a `quilt_packages` directory on the shared file system.
2. Set the `QUILT_PRIMARY_PACKAGE_DIR` to the path for `quilt_packages` in step 1.

   ```bash
    # select a path that you control & is durable, e.g.
    export SHARE_PATH=YOUR_SHARED_PATH/quilt_packages
    export QUILT_PRIMARY_PACKAGE_DIR=$SHARE_PATH
    mkdir -p "$SHARE_PATH"
    chmod o+r "$SHARE_PATH"
   ```
3. Install packages to the shared directory

   ```bash
    quilt build USERNAME/PACKAGE PATH_TO_BUILD_YML
    quilt install USERNAME/PACKAGE
   ```
4. Set read permissions on shared directory and sub-directories

   ```bash
    chgrp -R readers "$QUILT_PRIMARY_PACKAGE_DIR"
    chmod -R g+rx "$QUILT_PRIMARY_PACKAGE_DIR"
   ```

## Configure clients to read from shared directory

1. Each reader should set the following environment variable:

   ```bash
    # consider setting this in .bashrc
    export QUILT_PACKAGE_DIRS=$SHARE_PATH
   ```
2. Readers can can import shared packages as follows

   &#x20;example:

   ```python
    from quilt.data.USERNAME import PACKAGE
   ```

## Import precedence

Quilt will first check `QUILT_PRIMARY` (defaults to the local machine) and then check `QUILT_PACKAGE_DIRS` (if available) when importing a package.

Refer to the [Python API docs](/quilt-2-master/api/api-python.md) for details on quilt commands.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.quilt.bio/quilt-2-master/advanced-usage/shared-store.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
