The Linux Sync command is used for data synchronization, and the Sync command is used when shutting down the Linux system.
The Linux system to write to the hard disk data sometimes will be more efficient, will write to filesystem buffer, this buffer is a memory space, if you want to write to the hard disk data in this buffer, and the system suddenly power down, then the data will be lost, The sync command forces the data stored in buffer to be written to the hard disk.
Grammar sync (option)
Buffer and Cache
Buffer: To solve the efficiency of writing disk
Cache: To solve the efficiency of read disk
In order to improve the efficiency of reading and writing disks, the Linux system will first put the data in a buffer. Writing a disk does not immediately write the data to disk, but instead writes it to the buffer first. This can result in data loss if the system is restarted. The sync command is used to flush the file system buffer so that the data is actually written to the disk and buffer is released, flush is used to empty the buffer. The sync command forces the data to be written to disk and releases the buffer corresponding to the data, so it is common to enter the sync command after the disk is written to actually write the data to disk. If you do not manually enter the sync command to actually write to the disk, the Linux system will periodically go to sync data.
Linux Sync Command