I have 2 computers. 1 computer install ubuntu server and 1 machine working daily. On ubuntu I installed lxd with snap and I created a container called webServ
webServ container và ubuntu host chia sẻ chung folder sites bằng lệnh
lxc config device add webServ sites disk source=~/rslsync/sites path=/var/www shift=true
Ubuntu host and my 2nd computer sync data with Resilio, including ~/rslsync/sites directory on ubuntu host.
The problem I am having is that if I edit the file directly in the ~/rslsync/sites folder on the ubuntu host then when I go into the webServ container I read the file I will see the updates. But if I edit the file on 2nd computer, it will only see the update on ubuntu host but not in webServ container.
Before:
After:
I don’t know where the problem is and is there a way to work it out?
That’s most likely a shiftfs caching bug. This can happen in some cases when the underlay is changed but the overlay has cached the file.
I’ve personally had better luck with this with more recent kernels (5.8), so you may want to install the linux-generic-hwe-20.04 kernel on your system and see if that helps.
In general, those kind of issues is what’s caused us to go a completely different route when upstreaming this feature in the Linux kernel and instead doing things at the VFS layer rather than as a standalone filesystem.
The Linux 5.12 kernel should release with this new approach and LXC and LXD will automatically use the new logic when available, hopefully making this a problem of the past over the next year or so (we need some time for things to mature and distributions to adopt suitable kernels).
@stgraber As Kernel Version 5.12 is now released, I would like to ask some questions: Above you say that LXD will use the new approach automatically, so I assume it is already included in the latest LXD version?
And does it automatically replace shiftfs and all the shift options?
Or are further settings (like new options) necessary?
Also I assume there will be more information available, especially regarding potential differences and downsides?
Yeah, we intend to keep supporting shiftfs in LXD until LXD 5.0 at which point we’ll drop support for it and the only mount shifting option will be to run a 5.12 kernel or higher.
Update2: Oh sry, didn’t see that you are the original reporter.
So your problem is not that you don’t have shiftfs…
In that case everything is explained above.
For everyone else who might be searching for a solution for 5.11: