• 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
    • Unravel the Curse: Your Essential Guide to Curse of Strahd PDF
    • Tips to Reduce PDF File Size: A Comprehensive Guide for Efficient Document Management
    • Download the Ultimate 365-Day Guide to Conquering Fear with Bible Verses (PDF)
    • Unlock Safe Driving in California: The Essential Guide to the 2023 DMV Handbook
    • How To Make A Fillable PDF Form: The Ultimate Guide
    • 5e Dungeon Master’s Guide: Essential PDF for Epic Storytelling
    • How to Effortlessly Convert PNG to PDF: A Comprehensive Guide
    • Unlocking Imagination: A Guide to “Kids on Brooms” PDFs
    • Master Tax Withholding with our Comprehensive W-4 2023 PDF Guide
    • How to Access the St. Louis County Jail Roster PDF
  • Ranking

About Arras WordPress Theme

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