How do I know if a file or files are in deferred state using bash? Is there a way to detect this?
sample:
when saving a file, kernel cache the file and not yet written on the disk. this is the D state or deferred state. when its deferred state, when you check the file like php -r "var_dump(file_exists($filename));"
, the kernel will respond, yep the file is there. but in reality, the file wasn't written on the disk yet. and when the server got restarted, the file is gone.
the event happened to us and i want to prevent it or create a monitoring tool that detects it and notify us so we can copy the files on other server before restarting it.