incus icon indicating copy to clipboard operation
incus copied to clipboard

Add `incus storage volume file` and `incus storage volume mount`

Open nsanity2097 opened this issue 11 months ago • 3 comments

We can mount incus instance filesystems on or offline. We should be able to mount incus filesystem volumes the same way if the volume is not attached to a running instance.

If i attach a volume to an instance, then mount the instance - it only mounts the root_fs.

or is there an alternative approach?

version

root@ubu-node-0:~# incus version
Client version: 6.9
Server version: 6.9

oci container config

root@ubu-node-0:~# incus config show prometheus --expanded
architecture: x86_64
config:
  environment.HOME: /home
  environment.PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  environment.TERM: xterm
  image.architecture: x86_64
  image.description: docker.io/prom/prometheus (OCI)
  image.id: prom/prometheus
  image.type: oci
  migration.stateful: "true"
  volatile.base_image: 6559acbd5d770b15bb3c954629ce190ac3cbbdb2b7f1c30f0385c4e05104e218
  volatile.cloud-init.instance-id: 0091ae95-7585-4f71-b80f-78c1e04dacb9
  volatile.container.oci: "true"
  volatile.eth0.hwaddr: 00:16:3e:6e:7d:a9
  volatile.eth0.name: eth0
  volatile.idmap.base: "0"
  volatile.idmap.current: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
  volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
  volatile.last_state.idmap: '[]'
  volatile.last_state.power: STOPPED
  volatile.last_state.ready: "false"
  volatile.uuid: f8e567dd-4963-42fa-8919-3d1bb64683bd
  volatile.uuid.generation: f8e567dd-4963-42fa-8919-3d1bb64683bd
devices:
  eth0:
    network: incusbr1
    type: nic
  prometheus-cfg:
    path: /etc/prometheus
    pool: shared-pool
    source: prometheus-cfg
    type: disk
  prometheus-data:
    path: /prometheus
    pool: shared-pool
    source: prometheus-data
    type: disk
  root:
    path: /
    pool: shared-pool
    type: disk
ephemeral: false
profiles:
- default
stateful: false
description: ""

incus storage volume info

root@ubu-node-0:~# incus storage volume info shared-pool prometheus-data
Name: prometheus-data
Type: custom
Content type: filesystem
Location: ubu-node-1
Created: 2025/02/05 19:34 UTC

incus file mount example

root@ubu-node-0:~# incus file mount prometheus/ ~/prometheus/
sshfs mounting "prometheus/" on "/root/prometheus"
Press ctrl+c to finish

root@ubu-node-0:~# cd prometheus/
root@ubu-node-0:~/prometheus# ls -ltr
total 152
drwxrwxrwt 1 root   root        2 Dec  4  2023 tmp
drwx------ 1 root   root        2 Dec  4  2023 root
drwxr-xr-x 1 root   root        2 Dec  4  2023 dev
drwxr-xr-x 1 root   root        4 Dec  4  2023 var
drwxr-xr-x 1 nobody nogroup     2 Dec  4  2023 home
drwxr-xr-x 1 root   root        5 Dec 15  2023 usr
drwxr-xr-x 1 root   root        2 Dec 15  2023 lib
-rw-r--r-- 1 root   root     3773 Jan  2 14:07 NOTICE
-rw-r--r-- 1 root   root    11357 Jan  2 14:07 LICENSE
-rw-r--r-- 1 root   root    86438 Jan  2 14:15 npm_licenses.tar.bz2
drwxr-xr-x 1 root   root        2 Jan  2 14:15 sys
drwxr-xr-x 1 root   root        2 Jan  2 14:15 proc
drwxr-xr-x 1 root   root      409 Jan  2 14:15 bin
drwxr-xr-x 1 root   root       14 Feb  5 19:55 etc
drwxr-xr-x 1 nobody nogroup     3 Feb  5 20:16 prometheus
root@ubu-node-0:~/prometheus# cd prometheus/
root@ubu-node-0:~/prometheus/prometheus# ls -ltr
total 4
drwxr-xr-x 1 root root 2 Feb  5 20:16 tls
root@ubu-node-0:~/prometheus/prometheus# cd ../..
^Cremote host has disconnected
Error: exit status 1

root@ubu-node-0:~# incus file mount prometheus/prometheus/ ~/prometheus/
sshfs mounting "prometheus/prometheus" on "/root/prometheus"
Press ctrl+c to finish
root@ubu-node-0:~# cd prometheus/
root@ubu-node-0:~/prometheus# ls -ltr
total 4
drwxr-xr-x 1 root root 2 Feb  5 20:16 tls
root@ubu-node-0:~/prometheus# pwd
/root/prometheus
^Cremote host has disconnected
Error: exit status 1

nsanity2097 avatar Feb 05 '25 20:02 nsanity2097

This is going to be a feature on the larger side. We have a lot of existing logic around this but it still won't be trivial to put in place.

stgraber avatar Feb 05 '25 23:02 stgraber

Hi, I am a student at UT Austin taking a virtualization course and would like to work on this issue. Could I be assigned to this issue?

Aryan470 avatar Apr 20 '25 22:04 Aryan470

Done!

stgraber avatar Apr 21 '25 03:04 stgraber