3

i am having the following problem with an overlayfs: I can mount an overlayfs fine using the following line in my etc/fstab

none /home/student overlayfs lowerdir=/home/student,upperdir=/home/.student_rw 0 0

this works great and the mount command displays the overlayfs corretly:

 pc:~$ mount -l -t overlayfs
 none on /home/student type overlayfs (rw,lowerdir=/home/student,upperdir=/home/.student_rw)

so now when a student logs out of the machine i delete the contents of /home/.student_rw using a script - which also works fine.

the problem is that the student logging in, should find a clean home directory with the settings preconfigured in (/home/student) as the overlayfs does not touch the lowerdir folder.

the exact same approach worked very well for aufs, which are no longer supported in precise.

interestingly, the overlayfs approach works fine as long as i reboot the machine. so how can i fix this problem? for me a possible solution seems to be to let the upperdir reread the lowerdir. how would i do that?

thanks

1 Answers1

3

well, i found the solution myself

mount -o remount /home/student 

does the trick to reread the lowerdir. which i added to the script that removes the files in /home/.student_rw

badgerhill
  • 56
  • 1
  • Apparently with the latest Ubuntu precise kernel (3.2.0-24.39) remount is not enough to refresh lowerdir changes to target when there are changes on the lowerdir. Everything is ok if you just edit the the files, but if the inode changes (e.g. you copy a new file over the old one). Changes are not propagated and it's indeed undefined what happens. – Manwe May 30 '12 at 14:27
  • see this regarding inode changes: https://superuser.com/questions/421663/how-to-force-upperdir-overlayfs-to-reread-reload-lowerdir – wuppi Apr 18 '19 at 12:08
  • this did it for me on ubuntu 20.04 LTS with HWE kernel. – wuppi Oct 28 '21 at 08:23