Skip to main content
You can manage Fly Volumes using the fly volumes command. Fly Volumes are local persistent storage for Fly Machines. Learn how Fly Volumes work.
Note: fly volumes is aliased to fly volume and fly vol.

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.

Create a volume

Create a Fly Volume:
Use the --region option to set a region, or select a region when prompted. Use the --count option to create more than one volume. Use the --snapshot-retention option to change the number of days we retain snapshots (default is 5 days). Use the --scheduled-snapshots=false option to disable automatic daily snapshots. For more options, refer to the fly volumes create docs or run fly volumes create --help.

Extend a volume

You can make a volume bigger using the fly volume extend command. Note that you can extend (increase) a volume’s size, but you can’t make a volume smaller. You can also configure a volume to extend automatically after a certain threshold using the Machines API or in the [mounts] section of your app’s fly.toml file.
  1. Run fly volumes list and copy the ID of the volume to extend.
  2. Extend the volume size:
  3. (Optional) Check the new volume size in the Machine’s file system:
    Example output:
    In the preceding example, the volume is mounted under /storage and has been resized to from 1GB to 2GB. The df command shows disk space in 1K blocks by default. Use the -h flag to return a more human-readable format.
For options, refer to the fly volumes extend docs or run fly volumes extend --help.

Create a copy of a volume (Fork a volume)

Create an exact copy of a volume, including its data. By default, we place the new volume on a separate physical host in the same region. Use the --region option to fork the volume into another region.
Important: After you fork a volume, the new volume is independent of the source volume. The new volume and the source volume do not continue to sync.
  1. Run fly volumes list and copy the ID of the volume to fork.
  2. Fork the volume:
    Example output:
  3. (Optional) Use fly scale count to create a new Machine that picks up the unattached volume, or attach the volume to a new Machine by cloning with the following command:
For options, refer to the fly volumes fork docs or run fly volumes fork --help. A detailed guide to volume forking is also available.

Add a volume to an unmanaged Machine

For Machines that aren’t managed with Fly Launch (fly.toml and fly deploy), you can create a volume and attach it when you clone a Machine. You can also clone a Machine with a volume to get a new Machine with an empty volume.
  1. Create the volume in the same region as your app. For example:
  2. Clone one of your app’s Machines (with no volume) and attach the volume you just created:
    destination-mount-path is the directory where the volume should be mounted on the file system. Note that you can’t mount a volume with a destination-mount-path of /, since / is used for the root file system. For example:
  3. Repeat the preceding steps as needed to create more Machines with volumes.
  4. Confirm that the volume is attached to a Machine with fly machine list or fly volumes list.
  5. (Optional) Destroy the Machine used to create the clone:

Clone a Machine with a volume

Clone a Machine with a volume to create a new Machine in the same region with an empty volume. Use the -r option to clone the Machine into a different region.
  1. Run fly status and copy the Machine ID of the Machine to clone.
  2. Clone the Machine:
  3. List volumes to check the result:
    Example output showing two volumes with attached Machines:
Note: fly machine clone doesn’t write data into the new volume.
For options, refer to the fly machine clone docs or run fly machine clone --help.

Destroy a volume

Warning: When you destroy a volume, you permanently delete all its data. There is no undo. Make sure you’ve backed up any data you want to keep.
  1. List volumes and find the ID for the one you want to destroy:
  1. Destroy the volume using its ID:
For options, refer to the fly volumes destroy docs or run fly volumes destroy --help. Volumes attached to Machines Volumes attached to Machines can’t be destroyed. You can check which Machine (if any) a volume is attached to by running fly volumes list First, stop and destroy the Machine, then the unattached volume can be destroyed. If you’re replacing the Machine, use fly scale count or fly machine clone to launch a new one. This will create and mount a fresh volume based on your fly.toml config. To stop using volumes entirely, remove any [mounts] from fly.toml and redeploy. The Machine will be replaced without the volumes. After redeploying, you can destroy the volumes. Note: Snapshots taken before deletion may still be restorable for a limited time, provided you have the volume ID (default retention is 5 days).

Restore a deleted volume

You can restore data from a deleted volume using a volume snapshot. At this time, you can only retrieve a deleted volume’s ID for 24 hours after deletion. If you already have the volume ID, then you can still use it to access the volume’s snapshots within the snapshot retention period. The default snapshot retention period is 5 days. Learn how to set or change the snapshot retention period.
  1. Run fly volumes list --all and copy the ID of the deleted volume.
  2. List the volume’s snapshots and copy the ID of the snapshot to restore:
    Example output:
  3. Restore from the volume snapshot into a new volume of equal or greater size:
    Example output:
For options, refer to the fly volumes snapshots docs or run fly volumes snapshots --help.