I had the same problem.
The solution is shiftfs:
- Check wether your kernel includes shiftfs (to my knowledge only ubuntu’s kernel does).
You can check that with:
modinfo shiftfs
1.a) If your kernel does not include it, you can use dkms to install shiftfs:
I created a github repo with scripts to install shiftfs via dkms:
- Activate it within lxd:
Excerpt from comment by stgraber:
- sudo snap set lxd shiftfs.enable=true
- sudo systemctl reload snap.lxd.daemon
Check whether it is activated:
- lxc info
And should see:
shiftfs: "true"
- To use it with your container, you just need to add “shift: true” to your disk device.
For example:
folder1: path: /home/user1/folder1 source: /home/hostuser1/folder1 shift: true type: disk
And it should work.
Edit: Added my github repo.