Is it possible to run LXDs in RAM?

I am working on a project that involves the creation and deletion of LXDs and I want to limit disk writes as everything should be in memory. That led me to wonder if it is possible to run LXDs in RAM? Something like a ramdisk but for my containers.


So assuming you’re using the snap, you could do:

  • mount -t tmpfs tmpfs /var/snap/lxd
  • systemctl restart snap.lxd.daemon.unix.socket snap.lxd.daemon
  • lxd init

Then choose the dir storage backend and everything will be stored on a tmpfs.
On reboot, doing that again as everything will be gone.

1 Like

Thanks Stephane. Very helpful. I have been following your posts for a while so wanted to take this opportunity to thank you for all your work!

One question, you mentioned “if you are using snap”. Is there a difference between the snap and the apt version?

The deb stores data at /var/lib/lxd instead

1 Like