Wednesday, 11 September 2013

remount disk with running process

remount disk with running process

I have an embedded application that I am working on. To protect the data
on this image its partitions are mounted RO (this helps prevent flash
errors when the power is lost unexpectedly since I cannot guarantee clean
shutdowns, you could pull the plug)
An application I am working that needs to be protected resides on this RO
partition, however this program also needs to be able to change
configuration files on the same RO file system. I have code that allows me
to remount this partition RW as needed (eg for firmware updates), but this
requires all the processes to be stopped that are running from the read
only partition (ie killall my_application). Hence it is not possible for
my application to remount the partition it needs to modify without first
killing itself (I am not sure which one is the chicken and which one is
the egg, but you get the gist).
Is there a way to start my application in such a way that the entire
binary is kept in RAM and there is no link back to the partition from
which it was run so that the unmount reports the partition as busy?
Or alternatively is there a way to safely remount this RO partition
without first killing the process running on it?

No comments:

Post a Comment