hdparm –security-set-pass
hdparm –security-unlock
hdparm –security-disable
For example:
hdparm –security-disable xxx /dev/sdb
———-
security_password=”xxx”
/dev/sdb:
Issuing SECURITY_DISABLE command, password=”xxx”, user=user
hdparm –security-set-pass
hdparm –security-unlock
hdparm –security-disable
For example:
hdparm –security-disable xxx /dev/sdb
———-
security_password=”xxx”
/dev/sdb:
Issuing SECURITY_DISABLE command, password=”xxx”, user=user
hdparm as of 6.2 features the PIO data security commands that enable the user to lock and unlock IDE drives. These functions need CONFIG_IDE_TASK_IOCTL to be enabled. Read More...
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