Cannot destroy a volume or deploy new version of the app

I have a volume mounted on my app, and i want to use the app with no volumes on it.

If i try to deploy the app without the volume mount section i get:

Error: machine 6e823e2c7e6387 [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

and if i try to delete the volume i get:

next-js-example- ✗ flyctl volumes delete vol_nxyzasdw -y --verbose
Error: failed destroying volume: message

How would be the way to proceed here without deleting the app completely?

Hi @upleveled

You’ll need to destroy the Machine the volume is attached to first.

fly machine destroy <machine ID> --force

Then you should be able to delete the volume using:

fly volumes delete <volume ID>

If you have more than one Machine with attached volumes in your app, then you can scale down to zero Machines, destroy the volumes, then run fly deploy and scale back up (since you’ve already deleted the mounts section in your fly.toml).

Also, if you do scale down to zero machines and then redeploy, you’ll get the recommended two Machines for high availability. If you only want one Machine you can add the --ha=false flag to the deploy command:

fly deploy --ha=false
1 Like