How does a write-back cache work

Improve hard drive write speed with write-back caching

First, let's explain what caching write back is and how it works. Write-back caching is a feature available on most hard drives to allow the hard drive to collect all of the data in the hard drive's cache before it is permanently written. Once a certain amount of data has been captured in the hard drive's cache memory, the entire block of data is transferred and stored in a single event.

As a result, the reduced write events can improve the data transfer of the hard disk and thus improve the writing speed. To verify that write-back caching is enabled on your hard drive: # hdparm -W / dev / sda / dev / sda: write-caching = 1 (on) Write-caching is enabled by default on most hard drives. This technology is particularly important for SSD (Solid State Drives), which are based on Flash technology and have a limited number of write / erase cycles. By transferring data to the volatile cache first and writing it in a single batch, write-back caching shortens the life cycle of most SSDs.

Not all systems belong to the same set of recommendations for power-on caching at power-on as they are for write-back caching. There is a risk of data loss in the event of a power failure, etc. In the event of a power failure, the data is on the hard drive. The drive's cache has no chance of being saved and is lost. This fact is particularly important for the database system. To disable write-back caching, set write-caching to 0: # hdparm -W0 / dev / sda / dev / sda: setting drive write-caching to 0 (off) write-caching = 0 (off) # hdparm -W / dev / sda / dev / sda: write-caching = 0 (off)

Something like that