How to update mounted squashfs filesystem? Is it safe to write to mounted block device(routers update firmware somehow)?
A squashFS is usually a single file in another filesystem (such as a FAT FS). It can also be copied raw to a single partition.
SquashFS cannot be modified. To modify a squashFS one must extract it modify the contents and "squash" it again.
On some Linux Distros, SquashFS is used in combination with OverlayFS ( or aufs or unionfs). These filesystems overlay another FS ontop of the squashFS which can be based on a ramfs or tmpfs filesystem that resides in RAM. When doing this, the bottom layer is the squashfs and the top layer is in RAM. This permits files of the squashfs to be modified in RAM only. This technique is called Copy-On-Write, and creates a new file in the RAM disk for every modified file in the squashfs. Alternative to saving the file in a RAM disk (ramfs or tmpfs) a folder in a real partition (FAT or otherwise) may be used. Using a real folder in a real file system will make modification be persistent across reboots. This is commonly used on pendrive distros.