Tag: Disk

How to Disable Disk Write Caching in Ubuntu To Prevent Data Loss | UbuntuHandbook

Disk write cache is a feature provided by drive vendors to improve the performance of the disks.
This feature can result in data loss if there are sudden power outages.
It depends on the application to decide whether to enable disk write cache or not.
For SATA SSD drives the following commands can be used to enable and disable write caching.

To know write caching is enabled/disabled
hdparm -W /dev/sda

To enable write cache
hdparm -W 1 /dev/sda

To disable write cache
hdparm -W 0 /dev/sda

where, /dev/sda is example SATA SSD used.

You can get the details of the drive susing lsscsi command.

Source: How to Disable Disk Write Caching in Ubuntu To Prevent Data Loss | UbuntuHandbook