---
title: "Volumes"
description: "Keep the files a service writes across deployments and restarts."
canonical_url: "https://harblet.com/docs/deploy/volumes"
---
# Volumes

> Keep the files a service writes across deployments and restarts.

Files that an image or Git service writes to its own disk are lost on every deployment and restart. A **volume** is a folder whose files stay. Use one for uploads, a SQLite file or the data folder of an app.

Databases don't need volumes. Harblet keeps their data by itself.

## Add a volume

<steps level="3">

### Open the tab

Open the service and go to **Volumes**.

### Enter the path

Enter the folder inside the container, for example `/data` or `/var/www/html`, and click **Add volume**.

The path starts with `/`, has no spaces and doesn't end with a slash. Each path can have one volume.

### Deploy

Click **Deploy**. The volume is there from this deployment on.

</steps>

<note>

A new volume is empty, and it hides the files the image has at that path. Choose a folder the app fills itself, not the one that holds its code.

</note>

## What changes for the service

- **It stays on one server.** The volume is on the disk of one server, so the service always runs there. If that server fails, the service waits for it to come back.
- **It runs as one instance.** You can't raise its [instances](https://harblet.com/docs/deploy/projects-and-services#run-several-instances) while it has volumes.
- **It stops briefly during a deployment.** Harblet stops the running version before it starts the new one, so the two never write to the same files.
- **A failed deployment leaves it down.** Harblet doesn't go back to the version before by itself, because that version may not read files the new one already changed. [Redeploy](https://harblet.com/docs/deploy/deployments#redeploy-an-earlier-deployment) the deployment before it, or fix the problem and click **Deploy**.

## Where the files live

A volume is a folder on the disk of the server the service runs on. It has no size limit of its own and shares the disk with everything else on that server.

<caution>

Volumes aren't part of Harblet's backups. If the server's disk fails, the files are gone. Keep copies of files you can't lose, for example with the app's own backup or in external storage such as S3.

</caution>

- A volume belongs to one service. Two services can't share one.
- [Removing a server](https://harblet.com/docs/administration/servers#remove-a-server) is refused while it holds a volume.
- After [restoring Harblet onto a new server](https://harblet.com/docs/backups/harblet-backups#after-the-restore), volumes start empty.

## Remove a volume

Click the trash button of the volume and confirm with **Remove volume**, then click **Deploy**. Harblet deletes the volume's files once the next deployment has succeeded. This can't be undone.

Deleting the service deletes its volumes and their files too.

## Errors

<table>
<thead>
  <tr>
    <th>
      Message
    </th>
    
    <th>
      What to do
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Enter a path like /data, without spaces or a slash at the end
    </td>
    
    <td>
      Use the full path of the folder, starting with <code>
        /
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      This path already has a volume.
    </td>
    
    <td>
      Each folder can have one volume.
    </td>
  </tr>
  
  <tr>
    <td>
      Set the service to one instance first. A volume lives on one server.
    </td>
    
    <td>
      Set <strong>
        Instances
      </strong>
      
       to 1 under <strong>
        Settings
      </strong>
      
      , then add the volume.
    </td>
  </tr>
  
  <tr>
    <td>
      Remove the service's volumes to run more than one instance.
    </td>
    
    <td>
      A service with volumes runs as one instance.
    </td>
  </tr>
</tbody>
</table>


## Sitemap

See the full [sitemap](https://harblet.com/sitemap.md) for all pages.
