Functions of Unix/Linuxsync commands

Source: Internet
Author: User

Functions of Unix/Linuxsync commands

Write cache command -- sync

After the unix system is started with the reboot command, the system prompts an error message, and some applications cannot work normally. After carefully checking the system files and comparing them with the initial correct backup, we found that some files were indeed damaged and we could not find the cause of the file being damaged, finally, I thought of writing the cache command-sync. I didn't run the sync command before reboot, which led to changes in the system file and failed to work normally.

The sync command runs the sync subroutine. If you must stop the system, run the sync command to ensure the integrity of the file system. The sync command writes all unwritten system buffers to the disk, including modified I-nodes, delayed block I/O, and read/write ing files.

The sync Command sends the stored permanent information of the file system to the physical media. Before suspending the system, for example, restarting the machine, you must execute the sync command. The Running Experience of unix systems shows that the sync command should be executed twice to ensure reliability, because the information is not actually written to the disk when the sync command is completed, this command has been executed once. After executing the sync command, wait until the disk work light is off (assuming there is a system work indicator light), and then stop the running of the machine or start the machine.

A unix system can be damaged at any time. Therefore, you must run the sync command before starting or shutting down the machine. Remember that under no circumstances will the execution of the sync command be careful.

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.