We have just introduced a new flyctl command that will allow you to extend the size of a target volume.
I know many of you have been waiting on this feature and it’s now available with version: v0.0.350.
Usage:
flyctl volumes extend <id> [flags]
Flags:
-a, --app string Application name
-c, --config string Path to application configuration file
-h, --help help for extend
-s, --size int Target volume size in gigabytes
Global Flags:
-t, --access-token string Fly API Access Token
-j, --json json output
--verbose verbose output
A few notes about this feature:
Attached VM’s leveraging the target volume will require a restart so the FS can be resized.
This feature can only be used to scale a volume up. Scaling down is not currently supported.
Question
We are playing with the idea of allowing users to define auto-expansion rules for Volumes. If this is something you’re interested in, what kind of options would you like to see?
I resized a volume from 1 GB to 3, flyctl volumes list reports the size as 3GB, trying to re-run the extend says Error failed to extend volume: Invalid volume size - Specified volume size must be greater than 3 so Fly really thinks it is 3 GB.
However, inside the restarted VM I still get
/ # dmesg | grep vdc | head -1
[ 0.060596] virtio_blk virtio2: [vdc] 2088960 512-byte logical blocks (1.07 GB/1020 MiB)
/ # df -h /blah
Filesystem Size Used Available Use% Mounted on
/dev/vdc 988.0M 902.5M 18.4M 98% /blah
The kernel sees a block device of only 1 GB:
/ # cat /sys/block/vdc/size
2088960
/ # resize2fs /dev/vdc
resize2fs 1.46.2 (28-Feb-2021)
The filesystem is already 261120 (4k) blocks long. Nothing to do!
Thank you for fixing the general problem; don’t worry about my volume. I’m piggybacking on an incompatible wire protocol change (not by choice!) to bring up a second server and migrate to that.