Does Hard reboot damage my Ubuntu

Solution 1:

It won't cause security problems or vulnerabilities.
But it can cause damage on your OS and loss of data depending on the tasks that are running at the time.
That being said, your computer still shouldn't get stuck at high ram usage.

Solution 2:

Obviously you will loose the amount of data that is in your RAM at that time and hasn't been written to disk, yet. Also there is a theoretical chance of data/file-system corruption.

From my own experiences I can tell you that I'm hard-resetting my PC 4-5 times a day over the last 5 years and never had the problem of corrupted filesystems. I think ext3/ext4/ufs are pretty robust for this kind of failures.

In opposite to this I think NTFS is far more prone to this. On my Windows gaming rig I have a ~15% chance of file system corruption after a blue-screen and I'll have to to boot from disk to run a file system repair tool in that case ... **sigh**

Solution 3:

You run the risk of causing filesystem inconsistencies. It is better, even when out of RAM, as this normally still works in such situations, to use the alt-sysrq sequence, as that will attempt to shut things down as cleanly as possible (if it fails, then you're no worse off than if you pressed the power button, but if it succeeds then you're potentially better off). The sequence is as follows:

Hold down the alt key and the key marked "sys rq" at the same time (if you're on a laptop you might well need to hold down a special key on the laptop to get to the "sys rq" function). With those keys held down, press and release the following letters in the following order:

  1. R - this regains control of the keyboard from any applications that have grabbed keyboard focus
  2. E - attempt to cleanly terminate all processes
  3. I - attempt to immediately terminate all processes (will get rid of everything that failed from previous key)
  4. S - sync all filesystems (this is the most important part)
  5. U - remount all filesystems read-only (sometimes this is needed to flush data to disk)
  6. B - perform hard reboot (replace with O to turn off the power instead of rebooting)

Solution 4:

Maybe this will help a little, by default ubuntu and others swappiness are set to 60 , when your system reaches 60% of ram usage it changes to swap which is slow.

  1. Open this file on gedit or nano using: gksudo gedit /etc/sysctl.conf OR sudo nano /etc/sysctl.conf

  2. Add this to the end of the file: vm.swapiness = 0

  3. Save the file and reboot.

Also when it gets slow you should check if it is really using swap which slows down the system, otherwise the above changes wont help.