Problems with file loss after a sudden power outage in Linux

Source: Internet
Author: User

Because of the project needs, in the CentOS6.3 system, using the shell script I wrote to update the software, the operator will habitually immediately restart the power. However, after rebooting, the software is not working properly. Party a variety and I want reason ah ... It really made me miserable.

All kinds of asked Niang have Ah, there is no solution.

I did a few scripts upgrade experiments in the virtual machine, and there was no problem. Later, I think they update the device immediately after the power-off restart, try to give the virtual machine also do a power test test. Sure enough, after troubleshooting the power-off restart part of the software size becomes 0byte. So the startup of the software starting from the root does not work.

Really because the software immediately after the failure to power off the cause.

The next step is to work out how to save the file in the case of a power outage immediately.

The following online search for information:

In the Linux/unix system, it is usually put into the memory buffer in the process of file or data processing, and then written to disk when appropriate, to improve the efficiency of the system operation.

Workaround: Use the Sync command to force the data on the buffer to be written to disk.


Write this command two times at the end of the software upgrade script to ensure that the upgrade script is written to the hard disk immediately after the software is copied. At this point, the problem is resolved completely.

In fact, this command has been seen in some scripts. At that time I was also curious to know what the order was for, but I did not delve into it. It's really a fall into your wit. Fortunately, party A has no idea how quickly I can solve this problem.

This article is from the "Star Wind Memories" blog, please be sure to keep this source http://yuyongid.blog.51cto.com/10626891/1685044

Problems with file loss after a sudden power outage in Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.