How to correctly unmount and delete volumes

Hey, I was trying to delete a volume I created previously and attached to my app:

❯ fly volumes delete
? ID                    STATE   NAME            SIZE    REGION  ZONE    ENCRYPTED       ATTACHED VM     CREATED AT
Select volume: vol_4qpyoz22do8xnl8v     created wepeen_data     1GB     ams     90ce    true            2867002b729d28  3 days ago
Warning! Every volume is pinned to a specific physical host. You should create two or more volumes per application. Deleting this volume will leave you with 0 volume(s) for this application, and it is not reversible.  Learn more at https://fly.io/docs/volumes/overview/
? Are you sure you want to destroy this volume? Yes
Error: failed destroying volume: failed to destroy volume vol_4qpyoz22do8xnl8v: failed_precondition: volume is currently bound to machine: 2867002b729d28 (Request ID: 01JE1MA4GC75KH85M7NGFZ4CS2-arn)

The error message is clear but I don’t know how to unmount the volumen from the app. When I tried removing the volume from the config and redeploy I get:

Error: machine 2867002b729d28 [app] has a volume mounted but app config does not specify a volume; remove the volume from the machine or add a [mounts] section to fly.toml

I did not find anything in the dashboard to remove this. I think the first error message should specify the steps you need to take to remove the volume.

Thanks.

Remove the [[mounts]] section from your fly.toml and redeploy.

I tried that but I got the error message:

Error: machine 2867002b729d28 [app] has a volume mounted but app config does not specify a volume; remove the volume from the machine or add a [mounts] section to fly.toml

It’s a little counter-intuitive, but the procedure is actually to delete the machine first.

(Fly Machines are considered disposable, :leaves:.)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.