Sometimes a hard reboot is required when a computer gets itself into a bad state, in any operating system. In linux say, if a drive cannot be unmounted, even by force, how does a shutdown command manage to do it? What has shutdown got access to for force unmounting etc. that is not accessible from the terminal?
1 Answers
Shutdown will cause the system to try to gracefully close all the applications or services that are loaded. Applications will get notified that this is happening and given a short grace period to "make good their escape".
The next part of the shutdown process will trigger the operating system to tell the filesystem drivers to flush their stored data to the storage device. This should cause the filesystem driver to sanitize the filesystem prior to shutdown.
It will also then tell the drive that the filesystem is on to flush whatever hardware caches they have to disk.
If, after all that, there is still data locking the disk then it is tough luck as the system will simply shut down. If an application has refused to save its data or release it correctly then it is simply lost.
- 95,412