@greg_harvey What have you tried, and why wasn't it reliable?
@mansr For now I'm trying to run umount followed by mount, but sometimes the volume is busy so umount fails. `umount -l` works consistently for unmounting, but then I can't remount because I get told /dev/loop0 is busy and only a reboot seems to fix that. I tried `mount -t remount` as well, but that only *attempts* to remount and I'm not seeing the changes in the .sqsh image reflected in the mounted volume, so it seems that's failing silently. 🤔
@greg_harvey Busy means some process has a file on it open. You could find them and kill them (fuser can help here), but that might not be desirable.
@mansr It's worth a look, I suspect it's Nginx because the context here is mounting a SquashFS volume with some PHP code on (to save untarring 15,000 files on autoscaling events!) ... it all works well, except replacing the volume after a code release. I think it would be acceptable to kill Nginx for a few seconds to get the volume updated.
@mansr Actually, not Nginx, presumably PHP-FPM.
@greg_harvey If you know nginx/php is using the volume, the cleanest is probably to shut that down properly, do the remount, then restart the service.
@mansr True! And this is only happening in infra where there are multiple web heads, so it should be fine. I'll check it definitely is what I suspect first, and if it is then stopping the service, unmountin, remounting and starting the service again is probably as good as it'll get.
@mansr Stupidly, I tried stopping Nginx and it didn't help, so I kind of abandoned the idea. But I've just realised now that it's not Apache and mod_php so stopping Nginx is the wrong service. I should've stopped PHP-FPM. 🙄
@mansr Anyway, thanks for the idea, appreciate it! I'll give it a try in the morning. 🙂
For anyone interested in the resolution, I ended up doing this:
https://github.com/codeenigma/ce-deploy/pull/150/files#diff-2df9aa3d813b9132d97d1d686b6adfdb6ebdb7009e53b2900568af7aa64b923aR99
Thanks @mansr for pointing me in the right direction. This seems to work well, ideally I'd prefer not to have to reload services, but this is a solid solution. 🙂