Post AKWcudloPR3uhHdi9g by greg_harvey@tooting.ch
(DIR) More posts by greg_harvey@tooting.ch
(DIR) Post #AKWUZTiHo2NFn9O93o by greg_harvey@tooting.ch
2022-06-15T17:16:03Z
1 likes, 0 repeats
Dear Internet, does anyone know of a reliable way to unmount and remount a #squashfs file-system with a script, without rebooting the server? Because I'm struggling to find one. RTs gratefully received! #linux #toot
(DIR) Post #AKWUZV4ekLrW0orWZE by mansr@society.oftrolls.com
2022-06-15T19:58:03Z
0 likes, 0 repeats
@greg_harvey What have you tried, and why wasn't it reliable?
(DIR) Post #AKWbBZvXkcf9nD8kjo by greg_harvey@tooting.ch
2022-06-15T21:11:42Z
0 likes, 0 repeats
@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. 🤔
(DIR) Post #AKWbjjgtxJQfv8Zxy4 by mansr@society.oftrolls.com
2022-06-15T21:18:22Z
0 likes, 0 repeats
@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.
(DIR) Post #AKWc55Uy4Sa5dXB8BU by greg_harvey@tooting.ch
2022-06-15T21:22:12Z
0 likes, 0 repeats
@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.
(DIR) Post #AKWcB2uwa1c3MxAaP2 by greg_harvey@tooting.ch
2022-06-15T21:23:16Z
0 likes, 0 repeats
@mansr Anyway, thanks for the idea, appreciate it! I'll give it a try in the morning. 🙂
(DIR) Post #AKWcOZ8k5YZj4Q4RFo by greg_harvey@tooting.ch
2022-06-15T21:22:35Z
0 likes, 0 repeats
@mansr Actually, not Nginx, presumably PHP-FPM.
(DIR) Post #AKWcOaKTfPYYl6ZKBU by mansr@society.oftrolls.com
2022-06-15T21:25:45Z
0 likes, 0 repeats
@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.
(DIR) Post #AKWcn0ehRFKBMFfqts by greg_harvey@tooting.ch
2022-06-15T21:30:07Z
0 likes, 0 repeats
@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.
(DIR) Post #AKWcudloPR3uhHdi9g by greg_harvey@tooting.ch
2022-06-15T21:31:29Z
0 likes, 0 repeats
@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. 🙄