I want to execute a command automatically shortly before a filesystem is unmounted. The command still needs the filesystem to be mounted but I am interested in information as "new" as possible. Therefore a simple cron job is not a nice solution. (You can assume the command is df /the/mount/point.)
Is there any way to run a command automatically just before a filesystem is unmounted? Via a mount option or systemd or anything else?