initramfs – Netboot a machine, automatically rsync internal HDD to network master and continue booting from internal HDD

I have a server which stores the master image for a set of client computers.
As of now the clients netboot from the server and use an overlayfs, so any changes do not affect the master image.

Changes to the master image, can now result in undefined behavior, which is only fixed by a reboot of the clients. Also the clients are 100% dependent on the server, which means they are no usable if the server goes down for maintenance.

I would therefore like the clients to have a local copy of the master image, which is updated regularly e.g. upon boot.

What I envision is the following

  • The client boot over the network and get the kernel and initramfs from the server
  • It then synchronizes its internal HDD with a master image on the server
  • It continues booting with an overlayfs (so the copy of the master images does not change)

If possible i would like to avoid to much manual work. Much like I use the overlayroot package to take care of all the overlayfs stuff.