Linux Command Sync-forces the file buffer content in memory to be written to disk __linux

Source: Internet
Author: User
Purpose Description

The Linux kernel to achieve optimal disk operation efficiency, the data that needs to be written to disk is now cached in memory and is actually written to disk at the right time, which is not problematic in most cases and improves the efficiency of the system, but if the system is machine, power off, There will be some file content that will not be saved. When the Linux system shuts down or restarts, the contents of the buffer are automatically synchronized to the disk automatically. We can also manually execute the sync command, forcing the file buffer in memory to be written to disk, which is implemented by calling the sync system call. (Flush file system buffers.) Synchronize data on disk with memory. Force changed blocks to disk, update the super blocks. ' Sync ' writes any data buffered into memory out to disk.  this can Include (but isn't limited to) modified Superblocks, modified inodes, and delayed reads and writes.  I Mplemented by the kernel; The ' Sync ' program does nothing but exercise's ' sync ' system call.   the kernel keeps data in memory to avoid Doing (relatively slow) disk reads and writes.  this improves performance, but if the computer crashes, data May is L OST or the file system corrupted as a result. The ' Sync ' command ensures everything in memory be written to Disk.) However, I do not think it is necessary for us to execute this command in general, as the Linux kernel will automatically synchronize the data in memory to disk as soon as possible, and who knows when to lose power or machine.

Common Ways

Format: Sync

Forces the file buffer content in memory to be written to disk.

using the sample Example One

[Root@web ~]# Sync
[Root@web ~]#

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.