If the data stored on your volume updates frequently, then you should have other methods to back up or replicate your data in addition to daily snapshots. If you only have a single copy of your data on a single volume, and the host fails, then any data stored between the time when the snapshot was taken and the time when the failure occurred will be lost.
Set or change the snapshot retention period
Snapshot retention is the length of time (in days) that we store a volume snapshot. The default is 5 days. Set snapshot retention when you create a volume:[mounts] section of your app’s fly.toml file. Any new Fly Volumes fly deploy creates will have the new retention period. This example sets the snapshot retention period to 14 days:
Create a volume snapshot
We automatically take daily snapshots of your volume and keep them for 5 days by default. You can also create a snapshot of a volume on demand:-
Run
fly volumes listand copy the ID of the volume to create a snapshot from. -
Create a snapshot of the volume:
The snapshot might take a few seconds or longer to complete, depending on the volume size.
-
List the volume’s snapshots:
Example output:
waiting to running to created.
For options, refer to the fly volumes snapshots docs or run fly volumes snapshots --help.
Restore a volume from a snapshot
The procedure to restore data from a deleted volume is very similar, see Restore a deleted volume. Restore the data from a volume by creating a new volume from a snapshot:-
Run
fly volumes listand copy the ID of the volume to restore. -
List the volume’s snapshots:
Example output:
-
Restore data from the volume snapshot into a new volume of equal or greater size:
Example output:
fly volumes create docs or run fly volumes create --help.
Create a Machine with a volume from a snapshot
Create the volume and the Machine in one command:--with-new-volumes creates a new volume instead of reusing an existing one. --from-snapshot populates that volume from the snapshot. The trailing 1 is the Machine count.
For options, refer to the fly scale count docs or run fly scale count --help.
List snapshots and their stored sizes
Snapshots for each volume are stored incrementally, so only data that has changed since the previously stored snapshot consumes additional storage. The total stored size of the snapshots is used for Volume Snapshot billing.-
Run
fly volumes listand copy the ID of the volume. -
List the volume’s snapshots:
Example output:
Disable automatic daily snapshots
Automatic daily snapshots are enabled by default. To disable automatic snapshots, use the--scheduled-snapshots=false flag. Snapshots of encrypted volumes (defaults to true) are likewise encrypted at rest.
Disable automatic snapshots when you create a volume:
[mounts] section of your app’s fly.toml file. Any new Fly Volumes fly deploy creates will have automatic snapshots disabled: