3

Suppose there is no installation process running and the PC goes off without the usual shutdown command. Is there any risk for my OS to be damaged? If yes, then what are those?

In other words: Why do I need to shutdown Ubuntu?

jlliagre
  • 5,833
Sadegh
  • 1,105

2 Answers2

9

One reason is disk caching. There might be some data in the cache waiting to be written to a disk or USB drive, etc. where an instant turn off will drop the cache and whatever was there not written to disk will be lost.

To make matters worse, the disk cache doesn't just hold file content but file system meta-data. If the latter is referred to by other file system meta-data already written to the underlying storage medium, the file system may become corrupted and you may not just lose a file or two but potentially (though unlikely) the whole file system.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
Terrance
  • 41,612
  • 7
  • 124
  • 183
9

Firstly, how do you know that there is no (automated) package upgrade/installation process running at any given moment? In the 1–5 seconds that it takes you to look and turn off the computer, an installation may have been started. Only the shut down procedures of the operating system can ensure that no new service or task (e. g. package upgrading) was started since it checked for running tasks (i. e. by first stopping the task scheduler and then looking for still running tasks).

Secondly, when you ask the system to shut down, the system in turn asks all existing processes and services to shut down. Some processes and especially services running on any modern operating system perform clean-up operations when they're shut down. In the most simple cases this means to relinquish acquired resources, e. g. delete a temporary file; in more complex cases this means to save changes to disk that were accumulated over the life time of that process.

If you turn off your computer without asking the system running on it to shut down, it may clutter your disk with left-over temporary files and leave application data in an old or inconsistent state.

David Foerster
  • 36,264
  • 56
  • 94
  • 147