How do I Secure Erase my SSD drive in Linux?
如何在 Linux 中安全擦除我的 SSD 驱动器？
Secure Erase User Guide for Linux This guide will walk you through securely erasing your Kingston SSD using Linux tools   SATA Secure Erase Procedure Warning Please make sure to have a full backup of any important data before you proceed! Prerequisites • You must have root privileges. • You must have your SSD connected to the system as a secondary (non-OS) drive. • You must have lsscsi and hdparm installed. You may need to install them with your distribution’s package manager. • Your drive must not be in a security freeze. • Your drive must not be password protected. Instructions 1. Find the device name (/dev/sdX) of the drive you wish to erase: # lsscsi 2. Make sure drive security is not frozen: # hdparm -I /dev/sdX | grep frozen If the output shows "frozen" (instead of "not frozen") then you cannot continue to the next step. You must try to remove the security freeze by trying one of the following methods: Method 1: Put the system to sleep (suspend to RAM) and wake it up. On most distributions the command to suspend is: # systemctl suspend Now issue the hdparm command again. If it worked the output will show “not frozen” (instead of “frozen”). Method 2: Hot plug the drive. This is done by physically unplugging the SATA power cable from the drive and plugging it back in while the system is powered on. You may need to enable hot plug in BIOS. Not all systems support hot plug. Now issue the hdparm command again. If it worked the output will show “not frozen” (instead of “frozen”). 3. Set a user password on the drive. The password can be anything. Here we are setting the password to “p”: # hdparm --security-set-pass p /dev/sdX 4. Issue the secure erase command to the drive using the same password: # hdparm --security-erase p /dev/sdX This command may take a few minutes to complete. The drive password is removed upon successful completion. If the secure erase is interrupted or otherwise fails your drive may become security locked. In this case you can remove the security lock using the command below and then try the secure erase procedure again: # hdparm --security-disable p /dev/sdX   SATA Secure Erase Example   NVMe Secure Erase Procedure Warning Please make sure to have a full backup of any important data before you proceed! Prerequisites • You must have root privileges. • You must have your SSD connected to the system as a secondary (non-OS) drive. • You must have nvme-cli installed. You may need to install it with your distribution’s package manager. • Your drive must not be password protected. Instructions 1. Find the device name (/dev/nvmeXn1) of the drive you wish to erase: # nvme list 2. Issue the format command to the drive. Here we set the secure erase setting to 1 which indicates a user data erase: # nvme format /dev/nvmeXn1 --ses=1 This command may take a few minutes to complete.   NVMe Secure Erase Example
请参阅“适用于 Linux 的安全擦除用户指南” 该指南将指导您使用 Linux 工具安全地擦除 Kingston SSD   SATA 安全擦除程序 警告 请确保在继续之前先完全备份所有重要数据！ 前提条件 • 您必须拥有根权限。 • 您必须将 SSD 连接到系统作为辅助（非操作系统）驱动器。 • 您必须安装了 lsscsi 和 hdparm。您可能需要使用分发版的包管理器安装它们。 • 驱动器不得处于安全冻结状态。 • 驱动器不得有密码保护。 说明 1. 找到要擦除的驱动器的设备名称 (/dev/sdX)： # lsscsi 2. 确保驱动器安全性未冻结： # hdparm -I /dev/sdX | grep frozen 如果输出显示 "frozen"（而非 "not frozen"），则无法继续下一步。您必须尝试以下一种方法，消除安全性冻结状态： 方法 1： 使系统进入睡眠（挂起至 RAM），然后唤醒。在大多数分发版上，挂起的命令为： # systemctl suspend 此时再次发出 hdparm 命令。如果可行，输出将显示 "not frozen"（而非 "frozen"）。 方法 2： 热插入驱动器。在系统通电的状态下，以物理方式从驱动器拔下 SATA 电源线后再插回，便完成了热插入。您可能需要在 BIOS 中启用热插拔。并非所有系统都支持热插拔。 此时再次发出 hdparm 命令。如果可行，输出将显示 "not frozen"（而非 "frozen"）。 3. 在驱动器上设置用户密码。密码可以随意设置。这里我们将密码设置为 "p"： # hdparm --security-set-pass p /dev/sdX 4. 使用同一密码向驱动器发出安全擦除命令：1234567890 - 1234567890 - # hdparm --security-erase p /dev/sdX 此命令执行完成可能需要几分钟。驱动器密码在成功完成后将会删除。 如果安全擦除中断或失败，您的驱动器可能变成安全锁定。在此情况下，您可以使用下面的命令取消安全锁定，然后重试安全擦除程序： # hdparm --security-disable p /dev/sdX   SATA 安全擦除示例   NVMe 安全擦除程序 警告 请确保在继续之前先完全备份所有重要数据！ 前提条件 • 您必须拥有根权限。 • 您必须将 SSD 连接到系统作为辅助（非操作系统）驱动器。 • 您必须安装 nvme-cli。您可能需要使用分发版的包管理器安装它。 • 驱动器不得有密码保护。 说明 1. 找到要擦除的驱动器的设备名称 (/dev/nvmeXn1)： # nvme list 2. 向驱动器发出格式化命令。在此我们将安全擦除设置为 1，以指示用户数据擦除： # nvme format /dev/nvmeXn1 --ses=1 此命令执行完成可能需要几分钟。   NVMe 安全擦除示例