Due to an sd card corruption I decided to mount the root fs as read only. Therefore, I added the 'ro' argument in /etc/fstab
/dev/mmcblk0p1 /boot vfat defaults,ro 0 2
/dev/mmcblk0p2 / ext4 defaults,ro,noatime 0 1
After the device is booted, the filesystem is mounted read-only - so that's fine. However, sometimes I need write access to the file system. So, I remount the root fs with
sudo mount / -o remount,rw
as read/write. However, if I want to remount the filesystem with
sudo mount / -o remount,ro
I get the following error:
mount: / is busy
If I run:
fuser -v ./
I get the following output:
USER PID ACCESS COMMAND
pi 2421 ..c.. sftp-server
pi 2477 ..c.. bash
Does anybody know what's causing the problem? Why can the filesystem be mounted as read only at startup, but not if I remount it manually?