freebsd:freebsd_secure_erase_with_camcontrol

差分

このページの2つのバージョン間の差分を表示します。

この比較画面にリンクする

次のリビジョン
前のリビジョン
freebsd:freebsd_secure_erase_with_camcontrol [2018-04-27 00:17]
Decomo 作成
freebsd:freebsd_secure_erase_with_camcontrol [2020-04-14 10:54] (現在)
Decomo
行 1: 行 1:
-====== FreeBSDのcamcontrolでSecure Eraseする ======+====== FreeBSDのcamcontrolでSSDをセキュアイレース(Secure Erase)する ======
  
-sudo camcontrol security ada7 -U user -s erase -h erase +===== 試した環境 ===== 
-pass8: <TOSHIBA THNSNJ960PCSZ JZEE6102> ACS-ATA SATA 3.x device + 
-pass8600.000MB/s transfers (SATA 3.x, UDMA5, PIO 8192bytes)+  * FreeBSD 12.1-RELEASE 
 +  * Micron RealSSD C400 128GB (C400-MTFDDAK128MAM) 
 +  * CENTURY スライディング裸族 SATA6G (CSDRU3B6G) 
 + 
 +===== 手順 ===== 
 + 
 +今回はUSB接続としたため、secure erase対象のデバイスはda0となっている。ここは適宜読み替えのこと。 
 + 
 +==== デバイスの状態の確認 ==== 
 + 
 +まずはデバイスがセキュアイレースに対応しているかどうか調べる。 
 +<code> 
 +# camcontrol security da0 
 +pass9: <C400-MTFDDAK128MAM 08TH> ACS-ATA SATA 3.x device 
 +pass9400.000MB/s transfers 
 + 
 +Security Option           Value 
 +supported                 yes 
 +enabled                   no 
 +drive locked              no 
 +security config frozen    no 
 +count expired             no 
 +security level            high 
 +enhanced erase supported  yes 
 +erase time                2 min 
 +enhanced erase time       2 min 
 +master password rev       fffe 
 +</code> 
 + 
 +特に重要なのは、supported, security config frozen, enhanced erase supportedの項目で、意味は以下のとおり。 
 + 
 +  * supported 
 +    * デバイスがセキュアイレースに対応しているか否かを表す。noだったら非対応なのでddでゼロ埋めでもしてください。 
 +  * security config frozen 
 +    * デバイスが凍結状態か否かを表す。yesだと凍結状態なのでセキュアイレースができない。 
 +    * 悪意のあるソフトなどからの意図しないセキュアイレースを防ぐため、通常はPC起動時のPOSTの段階でfrozenされるようになっている。 
 +    * 凍結状態を解除するには、BIOSを抜けた後にデバイスを挿す、ないしマシンをスリープさせ、その間にデバイスの電源ケーブルを抜き差しする必要がある。 
 +      * これが嫌なので本記事ではUSBで後付けにしてるのであーる。 
 +  * enhanced erase supported 
 +    * デバイスが拡張セキュアイレース(Enhanced Secure Erase)に対応しているか否かを表す。 
 +    * secure eraseに加え代替セクタ情報なども含めて丸っと消去する。対応してるなら、こちらを使った方がいいみたい。 
 + 
 +==== Secure Eraseの実行 ==== 
 + 
 +以下のコマンドでセキュアイレースが実行できる。 
 +<code> 
 +# camcontrol security da0 -U user -s password -e password 
 +</code> 
 +パラメータの意味は以下のとおり。 
 + 
 +  * -U user 
 +    * securityコマンドの実行ユーザーを指定する。user|masterが指定できるが、基本的にはuserでいいらしい。 
 +  * -s 
 +    * securityコマンドを実行可能状態にする。冒頭ログのenabledをyesとなるような操作を行っている模様。 
 +  * -e 
 +    * セキュアイレースの実行 
 +  * password 
 +    * てきとーにパスワードを設定する。 
 +    * -Uと-sで指定ユーザーに指定パスワードでログインし、セキュリティ関連コマンドを実行するというイメージ。なので-sと-eのパスワードは一致させる必要がある。 
 + 
 +実際に実行してみた結果が以下のとおり。 
 +<code> 
 +# camcontrol security da0 -U user -s password -e password 
 +pass9: <C400-MTFDDAK128MAM 08TH> ACS-2 ATA SATA 3.x device 
 +pass9: 400.000MB/s transfers
  
 You are about to ERASE ALL DATA from the following device: You are about to ERASE ALL DATA from the following device:
-pass8,ada7: <TOSHIBA THNSNJ960PCSZ JZEE6102> ACS-ATA SATA 3.x device+pass9,da0: <C400-MTFDDAK128MAM 08TH> ACS-ATA SATA 3.x device
  
 Are you SURE you want to ERASE ALL DATA? (yes/no) yes Are you SURE you want to ERASE ALL DATA? (yes/no) yes
行 12: 行 76:
 Issuing SECURITY_ERASE_PREPARE Issuing SECURITY_ERASE_PREPARE
 Issuing SECURITY_ERASE_UNIT password='erase', user='user' Issuing SECURITY_ERASE_UNIT password='erase', user='user'
 +camcontrol: ATA SECURITY_ERASE_UNIT via pass_16 failed
 +</code>
  
-Erase Complete+最後にfailedしてるのは、コマンドがタイムアウトしたためらしい。
  
 +camcontrolはデバイスが返すerase time/enhanced erase timeの時間を見てタイムアウト時間を決めているそうだが、割と高確率でタイムアウトが発生する。
  
 +==== Enhanced Secure Eraseの実行 ====
  
 +以下のコマンドで拡張セキュアイレースが実行できる。
 +<code>
 +# camcontrol security da0 -U user -s password -h password
 +</code>
  
-sudo camcontrol security ada7 -U user -s erase -h erase +パラメータの意味は割愛。セキュアイレースと違うのは-eが-hになっただけ。 
-pass8: <TOSHIBA THNSNJ960PCSZ JZEE6102> ACS-ATA SATA 3.x device + 
-pass8600.000MB/s transfers (SATA 3.x, UDMA5, PIO 8192bytes)+<code> 
 +camcontrol security da0 -U user -s erase -h erase 
 +pass9: <C400-MTFDDAK128MAM 08TH> ACS-ATA SATA 3.x device 
 +pass9400.000MB/s transfers
  
 You are about to ERASE ALL DATA from the following device: You are about to ERASE ALL DATA from the following device:
-pass8,ada7: <TOSHIBA THNSNJ960PCSZ JZEE6102> ACS-ATA SATA 3.x device+pass9,da0: <C400-MTFDDAK128MAM 08TH> ACS-ATA SATA 3.x device
  
 Are you SURE you want to ERASE ALL DATA? (yes/no) yes Are you SURE you want to ERASE ALL DATA? (yes/no) yes
 Issuing SECURITY_SET_PASSWORD password='erase', user='user', mode='high' Issuing SECURITY_SET_PASSWORD password='erase', user='user', mode='high'
-camcontrol: ATA SECURITY_SET_PASSWORD failed: 0+Issuing SECURITY_ERASE_PREPARE 
 +Issuing SECURITY_ERASE_UNIT password='erase', user='user' 
 + 
 +Erase Complete 
 +</code> 
 + 
 +なぜかこちらはタイムアウトすることなく、すぐに終了。対象のデバイスによっても挙動が違うかも? 
 + 
 +===== で、本当に消去できてるの? ===== 
 + 
 +本当にSecure Erase出来てるかは、正直なところ良くわからない。 
 + 
 +デバイスごとに結構挙動が違うようで、今回のRealSSD C400+CSDRU3B6Gの場合、Secure Eraseコマンド発行後はアクセスランプが点滅し何かしら動いてそうではあるが、一晩経っても点滅しっぱなしだった。一方でEnhanced Secure Eraseの方は特に点滅することもなくすぐ終わるし。 
 + 
 +ついでにハマったのが、''gpart''コマンドの挙動。消去できたかの確認で''gpart show da0''してたんだけど、なぜか一旦デバイスを外さないと情報が更新されなかった。 
 + 
 +とりあえずデバイスの先頭1GiBが0になってるのは確認できたので、一応消去はされてるっぽい。 
 +<code> 
 +# hd -n 1073741824 /dev/da0 
 +00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................| 
 +
 +40000000 
 +</code> 
 + 
 +===== 参考サイト ===== 
 + 
 +  * [[https://wiki.ninth-nine.com/FreeBSD/camcontrol%20security|camcontrol security コマンド - セキュアイレース]] 
 +    * 大変詳しい解説が載っている。 
 +  * [[https://www.freebsd.org/cgi/man.cgi?camcontrol|camcontrol - FreeBSD Manual Pages]] 
 + 
  • freebsd/freebsd_secure_erase_with_camcontrol.1524755847.txt.gz
  • 最終更新: 2018-04-27 00:17
  • by Decomo