Attaching volumes at runtime

Hi… Making a volume larger is easy, but the other direction is not very smooth or convenient, unfortunately…

https://fly.io/docs/volumes/volume-manage/#extend-a-volume

https://fly.io/docs/machines/api/volumes-resource/#extend-a-volume

https://fly.io/docs/reference/configuration/#auto_extend_size_increment

Generally, you can’t remove the volume from a running Machine. You’d need to stop and then destroy it [the Machine] first. That’s typically ok, since Machines are designed to be disposable, and you’ll almost always want ≥2 of them, given that that’s more or less an architectural norm on the Fly.io platform. (Thus, the second Machine can handle traffic while the first is taken offline for overhaul.)

Moreover, if you wanted to preserve some of the now-too-large volume’s data, then you would need to perform that copying, to a newly created smaller volume, yourself. This can be handled via rsync or the like, but is another inconvenience.

Having said that, I attach new Machines to older volumes pretty frequently in experiments, and have never seen surprises.

Hope this helps!

1 Like