Wednesday, May 15, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 1602  / 2 Years ago, wed, february 16, 2022, 3:10:17

I was observing the use of the sync command and I have read that this command makes sure that anything in memory is written to disk.



As I was thinking of installing Ubuntu on a removable disk (USB) I would like to know if it is necessary to execute this command.



It worries me that when turning off the computer, if data are still being written, they end up losing because of the system shutdown.



Is it necessary to run sync before shutting down or restart the system?



Does anyone explain more about this?


More From » usb

 Answers
2

Data can be lost during unexpected shutdowns or system crashes - when the operating system cannot actually flush the data from memory to disk. During normal shutdown or restart the operating system is still in control, so it will write data to disk.



In other words, normal shutdowns/reboots are OK. There is also something know as halt state - where machine is still running, but OS has went through shutdown process and relinquished control of the hardware. In such case, powering off the machine is also OK. What's not OK is abnormal power offs and shutdowns.


[#6396] Wednesday, February 16, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
whipstder

Total Points: 189
Total Questions: 110
Total Answers: 99

Location: Uzbekistan
Member since Sat, Feb 27, 2021
3 Years ago
;