Fly.io machines are ephemeral — the local filesystem resets on every deploy. Fly Volumes provide persistent block storage that survives machine restarts, deploys, and even machine replacement. This guide covers setup and the patterns most relevant to AI applications.

Creating a Volume

# Create a 10 GB volume in the London region
fly volumes create ai_data --size 10 --region lhr
 
# List volumes for your app
fly volumes list
 
# Extend a volume (non-destructive, instant)
fly volumes extend vol_abc123 --size 20

Mounting a Volume in fly.toml

[mounts]
  source = 'ai_data'
  destination = '/data'

After adding the mounts section and redeploying, your app can read and write to /data and the data persists across deploys and restarts.

A Fly Volume is tied to a specific region and a specific machine. If you scale to multiple machines, each machine needs its own volume — data is not automatically replicated between volumes.

Recipe: Persistent Ollama on Fly.io

FROM ollama/ollama:latest
 
ENV OLLAMA_MODELS=/data/models
 
# Startup script: pull model if not already present
COPY start.sh /start.sh
RUN chmod +x /start.sh
CMD ["/start.sh"]
#!/bin/sh
# start.sh
ollama serve &
sleep 5
 
# Pull model only if not already cached on the volume
if [ ! -d "/data/models/llama3.2" ]; then
  echo 'Pulling llama3.2...'
  ollama pull llama3.2
fi
 
wait
# fly.toml
app = 'my-ollama'
primary_region = 'lhr'
 
[mounts]
  source = 'ollama_models'
  destination = '/data'
 
[[vm]]
  memory = '8gb'
  cpu_kind = 'performance'
  cpus = 4

Recipe: SQLite Database on a Volume

SQLite is often overlooked for small-to-medium AI applications. With a Fly Volume, a SQLite database is simple, fast, and reliable — no managed database service needed.

import os, sqlite3
 
# Store SQLite database on the persistent volume
DB_PATH = os.environ.get('DB_PATH', '/data/app.db')
 
def get_db():
    conn = sqlite3.connect(DB_PATH)
    conn.row_factory = sqlite3.Row
    return conn
 
# Database survives deploys because /data is a Fly Volume
SQLite on a Fly Volume is a surprisingly capable stack for AI applications serving under ~10,000 requests/day. It eliminates the cost and complexity of a managed Postgres instance for smaller deployments.

Volume Snapshots and Backups

# Create a snapshot of a volume
fly volumes snapshots create vol_abc123
 
# List snapshots
fly volumes snapshots list vol_abc123
 
# Restore from snapshot (creates a new volume)
fly volumes create restored_data \
  --snapshot-id vs_abc123 \
  --size 10 --region lhr
Metadata Value
Title Fly.io Volumes: Persistent Storage for Stateful AI Applications
Tool Fly.io
Primary SEO keyword fly.io volumes persistent storage
Secondary keywords fly.io sqlite, fly.io ollama, fly.io persistent data, flyctl volumes
Estimated read time 7 minutes
Research date 2026-04-14