Attaching volume to machine

Hello,

Currently having trouble attaching a volume to a machine. I have:

  1. Created an app and attached a volume
  2. Launched a machine on the app
  3. Tried to attach the volume to the machine using fly m update <m-id> -v <vol-id>:/data:size=1,encrypt

Using both size=1 and encrypt in the command results in:
Error Can’t infer volume and mount path from ‘encrypt’

Using just size=1 returns:

"mounts": [
+ 			{
+ 				"encrypted": false,
+ 				"path": "/data",
+ 				"size_gb": 0,
+ 				"volume": "vol-id",
+ 				"name": ""
+ 			}
+ 		],

I would expect the size_gb value to be 1. When applying this fly m list does not list a volume on the machine. Any details would be appreciated. Thank you.

A shot in the dark: See if size=3 works?

Gave size=3 a go and it’s the same issue. Using -v <vol_id>:/data:encrypt shows:

+ 		"mounts": [
+ 			{
+ 				"encrypted": false,
+ 				"path": "/data",
+ 				"size_gb": 0,
+ 				"volume": <vol-id>,
+ 				"name": ""
+ 			}
+ 		],

Would expect ecnrypted to be true :thinking: fly vol list shows that the volume is encrypted and does show the machine ID under ATTACHED VM.

I see size 0 for one other forum user: Cannot Connect to Machines on internal Service Port

If you can, then flyctl ssh console and df /data on the Machine to confirm its size?

# df /data
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/vda         8191416 495140   7260464   7% /

Am I reading this right? 8GB? The volume I created is 1GB and confirmed with fly vol list.

Yes, but /dev/vda is rootfs (ephemeral store mounted on /), which is 8Gs and comes for free with every Fly VM.

Persistent store (volumes) are (from what I have observed) virtual block device /dev/vdc (ex).

So, I guess, /data hasn’t been mounted at all… I haven’t used flyctl m update with volumes, may be someone else who has will chime in. You can also choose to run LOG_LEVEL=debug flyctl m update ... to see where the cmd is going wrong.

Other than that, to unblock yourself you can try the Machines REST API: https://archive.is/ptMyr#create-a-machine

1 Like

Kind of started over and launched a new machine first without ports and the volume seem to have mounted correctly. The volume now shows when listing machines and the size is ~1gb and encrypted. Updated the machine to expose the ports and all seems fine now.

1 Like

@Safinn As you’ve observed, you can’t use m update to change which volume is mounted to a VM (you can use it to change the mount point, though). The UX is in flux, though. (Edit to clarify: afaik you’ll still need to mount the volume at machine creation time.)

Did you get any error from fly m update? I think it will error if you try to update to a different volume if you already had one mounted, but I don’t know if trying to mount one to an already-created volume-less machine is caught by that.

2 Likes

I see, thank you for the information. I didn’t get an error when trying to add a volume to an already volume-less machine but the diff of the config showed that it would add a mount but the details were wrong. I haven’t tried changing volumes once I got one attached.

1 Like