Persistent Storage Volumes

Learn how to create and manage volumes in Andasy.

Volumes are persistent storage resources that can be attached to machines in Andasy. They provide a way to store data that persists even when machines restart or are recreated.

What is Persistent Storage?

By default, the filesystem in a container is ephemeral. When a container stops or is recreated, all data written to the filesystem is lost. Persistent storage (volumes) solves this by providing a separate storage area that:

  • Survives restarts - Data remains even when machines restart
  • Survives recreations - Data persists when machines are recreated or updated
  • Is backed up - Andasy automatically creates snapshots of volumes

When Do You Need Volumes?

Use volumes when your application needs to store data that must persist, such as:

  • Database files - PostgreSQL, MySQL, SQLite data files
  • File uploads - User-uploaded images, documents, or media
  • Application data - Cached content, generated reports, or configuration files
  • Log files - Long-term log storage (though logs are also available via andasy logs)

You don't need volumes for:

  • Temporary files or caches that can be regenerated
  • Application code (already in the container image)
  • Environment variables (handled via configuration)
  • Most stateless applications

How Volumes Work

Volumes are created independently of machines and can be attached to a machine. When attached, a volume appears as a directory (mount point) in your container's filesystem. Your application can read and write to this directory, and the data persists across container restarts.

Creating a Volume

To create a volume using the Andasy CLI, run the following command in your terminal:

andasy volumes create -a <app-name> -s <size> <volume-name>

Parameters:

  • <app-name> - The name of the application to associate the volume with
  • <size> - The size of the volume in MB (Mebibytes). Choose a size that accommodates your current needs plus room for growth
  • <volume-name> - A descriptive name for the volume (e.g., database-data, uploads, app-storage)

The volume will be created and associated with the specified application. Note that creating a volume doesn't automatically attach it to your machine. You need to configure the attachment in your andasy.hcl file (see below).

Volume Sizing:

Choose your volume size carefully. While you can create snapshots and restore from them, resizing volumes typically requires creating a new volume and migrating data. Start with a reasonable estimate and monitor usage.

Attaching a Volume to Machines

Volumes are attached to machines through the andasy.hcl configuration file. When you deploy your application, Andasy automatically attaches the volume to all machines running your application.

Add a storage block to your app configuration:

app_name = "my-app"

app {
  port = 80
  # ... other configuration ...

  storage {
    name = "database-data"
    destination = "/var/lib/postgresql/data"
  }
}

Configuration parameters:

  • name - The name of the volume you created (must match exactly)
  • destination - The mount point—the directory path inside the container where the volume will be accessible

The mount point is where your application will read and write persistent data. Choose a path that:

  • Doesn't conflict with system directories
  • Matches your application's expectations (e.g., database data directories)
  • Is clearly named for clarity (e.g., /app/data, /var/lib/app/storage)

After updating your andasy.hcl file, redeploy your application for the volume attachment to take effect.

List Volumes

To list all the volumes associated with an application, run the following command:

andasy volumes list -a <app-name>

Replace <app-name> with the name of the application that you want to list volumes for.

This command will display a list of all the volumes associated with the specified application.

Deleting a Volume

To delete a volume associated with an application, run the following command:

andasy volumes delete -a <app-name> <volume-id>

Parameters:

  • <app-name> - The name of the application that owns the volume (required if andasy.hcl is not present)
  • <volume-id> - The ID of the volume to delete (optional if only one volume exists)

Important Requirements:

Before deleting a volume:

  1. Detach the volume - Remove the storage block from your andasy.hcl and redeploy, or stop all machines using the volume
  2. Back up important data externally - Automatic backups are unavailable; recovery after deletion is not guaranteed
  3. Save the volume ID - Include it when requesting recovery from support

Temporary retention after customer deletion

Customer-deleted volume disks are retained for 60 days from the recorded deletion time before becoming eligible for permanent cleanup. This is a temporary policy while backup support is being redesigned. Contact support promptly with the volume ID if you need recovery; recovery is best effort and is not self-service.

Retaining a disk is not a backup and does not protect against host or disk failure. Keep independent backups before deleting a volume. No new final snapshot is promised when a volume is deleted. Existing snapshots may be downloadable using the snapshot commands.

Permanent cleanup requires ownership checks, no remaining machine attachment or use, and no administrative hold. Older volumes are reviewed before cleanup. After permanent removal, the disk cannot be recovered. This 60-day policy applies to customer deletion; billing suspension retention is separate.

Snapshots

Snapshots are point-in-time copies of a volume. They can be used to create a backup of your data or to restore your data to a previous state. Read more about snapshots here.