Linux command – nvme format

SSD

傳統的 SSD 硬碟在做硬碟資料抹除 (security erase 可以讓硬碟回覆到原本的效能水準) 是透過 #hdparm .

首先要檢查硬碟是否有支援 security set 指令.

[root@benjr ~]# hdparm -I /dev/sdb 

要先設定 security password 才能執行 security erase.

[root@benjr ~]# hdparm --security-set-pass 1234 /dev/sdb
[root@benjr ~]# hdparm --security-erase 1234 /dev/sdb

NVME

但是 nvme 在做資料抹除時,需要使用 # nvme format 指令.

[root@benjr ~]# nvme format /dev/nvme0 --namespace-id=1 --ses=1

參數
-n nsid, –namespace-id=nsid
Send the format command for the specified nsid. This can be used to override the default value for either character device (0xffffffff) or the block device (result from NVME_IOCTL_ID).

-s ses, –ses=ses
Secure Erase Settings: This field specifies whether a secure erase should be performed as part of the format and the type of the secure erase operation. The erase applies to all user data, regardless of location (e.g., within an exposed LBA, within a cache, within deallocated LBAs, etc). Defaults to 0.

  • 0
    No secure erase operation requested
  • 1
    User Data Erase: All user data shall be erased,contents of the user data after the erase is indeterminate (e.g., the user data may be zero filled, one filled, etc). The controller may perform a cryptographic erase when a User Data Erase is requested if all user data is encrypted.
  • 2
    Cryptographic Erase: All user data shall be erased cryptographically. This is accomplished by deleting the encryption key.
  • 3–7
    Reserved.

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步瞭解 Akismet 如何處理網站訪客的留言資料