Linux command – nvme format



傳統的 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 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


發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

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