Skip to main content
Fly Volumes are local persistent storage for Fly Machines. Learn more:

Launch a new app with a Fly Volume

Use Fly Launch to create a new app with one Machine and an attached volume, and then clone the Machine to scale out.
  1. Launch a new app from your project source directory with the --no-deploy option so it doesn’t deploy automatically. Include any required options for deploying your app, like --image or --dockerfile.
    fly launch creates a fly.toml app configuration file in your project source directory.
  2. After the app is created, add a [mounts] section in the fly.toml, where source is the volume name and destination is the directory where the volume should be mounted on the Machine file system. For example:
    Note: You can’t mount a volume with destination="/" since / is used for the root file system.
  3. Deploy the app:
  4. Confirm that the volume is attached to a Machine.
  5. (Recommended only if your app handles replication) Clone the first Machine to scale out to two Machines with volumes:
    List volumes to check the result:
    Example output showing two volumes with attached Machines:
Warning: fly machine clone doesn’t write data into the new volume.

Add volumes to an existing app

Add a volume to an app created with Fly Launch.
  1. Add a [mounts] section in the app’s fly.toml, where source is the volume name and destination is the directory where the volume should be mounted on the Machine file system. For example:
  2. Run fly status to check the regions of the Machines and then create the volume in the same regions as your app’s Machines. For example:
  3. Repeat step 2 for each Machine in the process group. If you create an app using the fly launch command, then the app will usually have two Machines in the app process by default.
    Note: If you have multiple Machines, then you need to create an equal number of volumes with the same name. For example, your app’s [mounts] config specifies source="myapp_data" and you have three Machines in bos (Boston), then you need to create three volumes named myapp_data in bos. Every volume has a unique ID to allow for multiple volumes with the same name.
  4. Deploy the app:
  5. Confirm that the volume is attached to a Machine.

Confirm the volume is attached to a Machine

Use flyctl to check the status of volumes and Machines.

List the Machines

List Machines to check attached volumes:
Example output:

List the volumes

List volumes to check attached Machines:
Example output:

SSH into the Machine

View the volume in the Machine file system:
Example output showing a 1GB volume mounted at /data:
The volume is mounted in the directory specified by the destination field in the [mounts] section of the fly.toml file, or the attach-volume option for cloned Machines.

Access a volume

Access and write to a volume on a Machine just like a regular directory. For Machines managed with Fly Launch, the destination under [mounts] in fly.toml is the path for the mounted volumes. For unmanaged Machines, you specify the mount path when you add a volume to a cloned Machine or create a Machine and attach a volume.