First let’s explain what is write-back caching and how it works. Write-back caching is a feature available on most hard drive’s to allow hard drive collect all data in hard drive’s cache memory before are permanently written. Once certain amount of data is collected in hard drive’s cache memory, the whole data chunk are transferred and stored with a single event.
As a result the reduction write events can improve hard drive’s data transfer thus improve write speed. To check whether write-back caching is enable on your hard drive use:
# hdparm -W /dev/sda /dev/sda: write-caching = 1 (on)
The write-back cache is enable by default on most hard drives. This technology is especially important for SSD ( Solid Sate Drives ) which are based on flash technology which has limited number of write/erase cycles. By transferring data first to volatile cache memory and write them in single batch, the write-back caching reduces life cycle of most of the SSD’s.
Not all system’s belong to the same “turn-on write-back caching” recommendation group as write-back caching caries a risk of data loss in the event such as power failure etc. In the event of power failure, data residing in the hard drive’s cache do not get a chance to be stored and a lost. This fact is especially important for database system. In order 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)