This, from a different discussion, reminded me that I wanted to ask a question ages ago, but never got around to asking.
A long time ago I did a basic UNIX course, on System V I think it was, and the instructor said "do a sync before you shutdown, this will ensure disk cache is written out".
So, I could do, and usually always do a
But there seems to be a subtle difference in the 'language' of the man pages. halt(8), and reboot(8) state "The halt and reboot utilities flush the file system cache to disk." shutdown(8) however does not say that. It does also say that you can use
So my question is, if I want to shutdown or reboot the system in the cleanest possible way, what command including flags, would achieve this?. Maybe I should be using
Try issuing a couple of sync(8) commands before umounting it.
A long time ago I did a basic UNIX course, on System V I think it was, and the instructor said "do a sync before you shutdown, this will ensure disk cache is written out".
So, I could do, and usually always do a
shutdown -r now
. Or I could do a halt -r
. Or I could do a reboot -r
.But there seems to be a subtle difference in the 'language' of the man pages. halt(8), and reboot(8) state "The halt and reboot utilities flush the file system cache to disk." shutdown(8) however does not say that. It does also say that you can use
shutdown -i
to cause shutdown to use halt, instead of init.(8) Why would I want to shutdown to to use halt instead of init, if, it indeed does do cache / file system flushing already? This suggests to me that shutdown does not ensure/do disk cache writing before shutdown. Is this true, or am I missing a key something?So my question is, if I want to shutdown or reboot the system in the cleanest possible way, what command including flags, would achieve this?. Maybe I should be using
shutdown -o -r now
?? Or should I always do a sync(8) first?