• About
  • Privacy Policy
  • Contact us
  • Submit a story
Linux-News Linux news from the Blogosphere
  • Article
  • Howto
  • News
  • Opinion
  • Review
  • RSS Feed
  • Twitter
  • Facebook

Don’t issue Direct Shutdown or Halt in Unix and Linux – Examples

By
News
– March 31, 2012Posted in: Article, Howto, Opinion, Submitted

Author: Gitesh

Multiuser systems such as Unix should never be just “shut off”. Active users connected to the system are rightfully miffed if their terminals die without warning. Even if the users have all logged out and gone home, there may be background jobs and daemons ticking away. Daemons get mad if their processes are suddenly curtailed.

A less obvious danger lays in the way the Unix file system works. For improved performance, when a file is changed, the disk version of that file is not always updated immediately. Usually, portions of the file to be changed are read into file buffers a part of the RAM memory. The changes may reside in memory for a while before being written to disk. Unix copies the data stored in memory to disk during periods of low processor activity to make the system more efficient. The price you pay for this more efficient use of processor time, however, is that a premature cessation of kernel activity may destroy the data before it is saved to disk. As you saw in the cleanup time section above, the fsck command tests for a corrupted file system, and helps you to repair the damage. But in mending the fule structure, some data may be lost. For all these reasons, Unix example and Linux provides several commands to the super user for a graceful shutdown. If you are in single-user mode and therefore already a root user, there is no need to warn other users to terminate their jobs, but you still have to flush any pending file I/O to ensure the data is saved correctly. Using command like /etc/haltsys, you can achieve this goal.


Executing this kind of command will flush the file buffers, mark the file system as clean, and then halt all kernel activity without any grace period or warning. Any background processes will dies, of course, so it is your responsibility to kill them safely before using “haltsys” command. A message then tells you that it is safe to power down or press any key to reboot. In some Linux system, we can use “SYNC” command to flush file buffers to disk. For flushing entire file buffers to disk use following command in Linux example before execution of shutdown whole system.

sync ; sudo echo 3 | sudo tee /proc/sys/vm/drop_caches

Of course, you can use SYNC command in other Unix flavors for flushing file system buffers from memory to disk. If you enabled direct IO for Oracle database server then also this flushing is essential for Unix example and Linux server for cleaning up memory caches before proceeding for system shutdown or halting system.

Article Source: http://www.articlesbase.com/operating-systems-articles/dont-issue-direct-shutdown-or-halt-in-unix-and-linux-examples-5653678.html


About the Author

Author is having 15+ years experience and providing Database Support and Online Oracle DBA Courses.

Tags: daemons, disk unix, fsck command, kernel, linux system, processor time, ram memory, single user mode, sync command, time section

About News

No Comments

Start the ball rolling by posting a comment on this article!

Leave a Reply Cancel reply

Your email address will not be published.

  • Suggested Sites
    http://linuxaria.com everything about Linux http://linuxaria.com everything about Linux
  • Curated topic
  • Recent Posts
    • Unlock TOEFL Success with Our Free Study Guide in PDF
    • Employment Act Malaysia 2023 PDF: A Comprehensive Guide
    • Convert PDF to DOC: A Comprehensive Guide to Effortless Document Conversion
    • Break the Horizon: Unlocking the Secrets of Numenera in PDF
    • Unlock the Power of “JPG to PDF”: A Comprehensive Guide for Mastering the Conversion
    • How to Effortlessly Delete Pages in a PDF: A Comprehensive Guide
    • Download and Navigate: Your Essential Guide to the NJ Transit Bus Schedule 2023 PDF
    • How to Convert PDF to Word: A Comprehensive Guide
    • Heart Healthy Diet Plan PDF: Tips for a Healthier Lifestyle
    • Master Chemical Engineering Optimization with the “Pyomo Chemical Engineers PDF Textbook”
  • Ranking

About Arras WordPress Theme

All site content, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.