Adding tmpfs mounts

I’m using oci images and would like to use tmpfs for some filesystem paths for e.g. cache directories or /tmp while also avoiding messing with the source image if I can help it.

Currently I’m solving this with something similar to this local-exec suggestion with:

  provisioner "local-exec" {
    command = "incus exec --project foo myinstance -- mount -t tmpfs -o size=3G cache /cache/"
  }

## TODO: https://github.com/lxc/terraform-provider-incus/issues/86
#   exec {
#     script = "something..."
#   }

I would appreciate instead being able to instruct incus to mount a tmpfs at such a directory, similar to tmpfs mounts | Docker Docs

Is there an easier way to do this in incus? (Other than e.g. creating a tmpfs & the host & pointing at it via a dir storage driver etc. which’ll surely go wrong in a few ways…) I’m thinking of a tmpfs storage driver or similar could be a useful feature?

Replying here in case it’s useful to anyone:

Incus 6.16 (August 20205) added the tmpfs and tmpfs-overlay disk types exactly for this purpose.

Stéphane explains the feature in Introducing Incus 6.16! (YT Zabbly 2025-08) and demonstrates how to use it later in the video (both links go to the exact timestamps – you’re welcome).

Note:

  • those types of device cannot be added after instance startup
  • tmpfs will make the directory empty upon startup like a usual tmpfs on Linux, so it’s perfect for /tmp and similar
  • tmpfs-overlay lets you see the existing directory content, but all modifications are written to an overlayfs on top of it and lost after a reboot. So it’s only useful for directories which already contain stuff, like e.g. /etc.
1 Like