差分
このページの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-3 ATA SATA 3.x device | + | |
- | pass8: 600.000MB/s transfers (SATA 3.x, UDMA5, PIO 8192bytes) | + | * FreeBSD 12.1-RELEASE |
+ | * Micron RealSSD C400 128GB (C400-MTFDDAK128MAM) | ||
+ | * CENTURY スライディング裸族 SATA6G (CSDRU3B6G) | ||
+ | |||
+ | ===== 手順 ===== | ||
+ | |||
+ | 今回はUSB接続としたため、secure | ||
+ | |||
+ | ==== デバイスの状態の確認 ==== | ||
+ | |||
+ | まずはデバイスがセキュアイレースに対応しているかどうか調べる。 | ||
+ | < | ||
+ | # camcontrol security da0 | ||
+ | pass9: <C400-MTFDDAK128MAM 08TH> ACS-2 ATA SATA 3.x device | ||
+ | pass9: 400.000MB/s transfers | ||
+ | |||
+ | Security Option | ||
+ | supported | ||
+ | enabled | ||
+ | drive locked | ||
+ | security config frozen | ||
+ | count expired | ||
+ | security level high | ||
+ | enhanced erase supported | ||
+ | erase time 2 min | ||
+ | enhanced erase time 2 min | ||
+ | master password rev | ||
+ | </ | ||
+ | |||
+ | 特に重要なのは、supported, | ||
+ | |||
+ | * supported | ||
+ | * デバイスがセキュアイレースに対応しているか否かを表す。noだったら非対応なのでddでゼロ埋めでもしてください。 | ||
+ | * security config frozen | ||
+ | * デバイスが凍結状態か否かを表す。yesだと凍結状態なのでセキュアイレースができない。 | ||
+ | * 悪意のあるソフトなどからの意図しないセキュアイレースを防ぐため、通常はPC起動時のPOSTの段階でfrozenされるようになっている。 | ||
+ | * 凍結状態を解除するには、BIOSを抜けた後にデバイスを挿す、ないしマシンをスリープさせ、その間にデバイスの電源ケーブルを抜き差しする必要がある。 | ||
+ | * これが嫌なので本記事ではUSBで後付けにしてるのであーる。 | ||
+ | * enhanced erase supported | ||
+ | * デバイスが拡張セキュアイレース(Enhanced Secure Erase)に対応しているか否かを表す。 | ||
+ | * secure eraseに加え代替セクタ情報なども含めて丸っと消去する。対応してるなら、こちらを使った方がいいみたい。 | ||
+ | |||
+ | ==== Secure Eraseの実行 ==== | ||
+ | |||
+ | 以下のコマンドでセキュアイレースが実行できる。 | ||
+ | < | ||
+ | # camcontrol security da0 -U user -s password -e password | ||
+ | </ | ||
+ | パラメータの意味は以下のとおり。 | ||
+ | |||
+ | * -U user | ||
+ | * securityコマンドの実行ユーザーを指定する。user|masterが指定できるが、基本的にはuserでいいらしい。 | ||
+ | * -s | ||
+ | * securityコマンドを実行可能状態にする。冒頭ログのenabledをyesとなるような操作を行っている模様。 | ||
+ | * -e | ||
+ | * セキュアイレースの実行 | ||
+ | * password | ||
+ | * てきとーにパスワードを設定する。 | ||
+ | * -Uと-sで指定ユーザーに指定パスワードでログインし、セキュリティ関連コマンドを実行するというイメージ。なので-sと-eのパスワードは一致させる必要がある。 | ||
+ | |||
+ | 実際に実行してみた結果が以下のとおり。 | ||
+ | < | ||
+ | # camcontrol security da0 -U user -s password -e password | ||
+ | pass9: < | ||
+ | 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-3 ATA SATA 3.x device | + | pass9,da0: <C400-MTFDDAK128MAM 08TH> ACS-2 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=' | Issuing SECURITY_ERASE_UNIT password=' | ||
+ | camcontrol: ATA SECURITY_ERASE_UNIT via pass_16 failed | ||
+ | </ | ||
- | Erase Complete | + | 最後にfailedしてるのは、コマンドがタイムアウトしたためらしい。 |
+ | camcontrolはデバイスが返すerase time/ | ||
+ | ==== Enhanced Secure Eraseの実行 ==== | ||
+ | 以下のコマンドで拡張セキュアイレースが実行できる。 | ||
+ | < | ||
+ | # camcontrol security da0 -U user -s password -h password | ||
+ | </ | ||
- | sudo camcontrol security | + | パラメータの意味は割愛。セキュアイレースと違うのは-eが-hになっただけ。 |
- | pass8: <TOSHIBA THNSNJ960PCSZ JZEE6102> ACS-3 ATA SATA 3.x device | + | |
- | pass8: 600.000MB/s transfers | + | < |
+ | # camcontrol security | ||
+ | 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-3 ATA SATA 3.x device | + | pass9,da0: <C400-MTFDDAK128MAM 08TH> ACS-2 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=' | Issuing SECURITY_SET_PASSWORD password=' | ||
- | camcontrol: | + | Issuing SECURITY_ERASE_PREPARE |
+ | Issuing SECURITY_ERASE_UNIT password=' | ||
+ | |||
+ | Erase Complete | ||
+ | </ | ||
+ | |||
+ | なぜかこちらはタイムアウトすることなく、すぐに終了。対象のデバイスによっても挙動が違うかも? | ||
+ | |||
+ | ===== で、本当に消去できてるの? ===== | ||
+ | |||
+ | 本当にSecure Erase出来てるかは、正直なところ良くわからない。 | ||
+ | |||
+ | デバイスごとに結構挙動が違うようで、今回のRealSSD C400+CSDRU3B6Gの場合、Secure Eraseコマンド発行後はアクセスランプが点滅し何かしら動いてそうではあるが、一晩経っても点滅しっぱなしだった。一方でEnhanced Secure Eraseの方は特に点滅することもなくすぐ終わるし。 | ||
+ | |||
+ | ついでにハマったのが、'' | ||
+ | |||
+ | とりあえずデバイスの先頭1GiBが0になってるのは確認できたので、一応消去はされてるっぽい。 | ||
+ | < | ||
+ | # hd -n 1073741824 /dev/da0 | ||
+ | 00000000 | ||
+ | * | ||
+ | 40000000 | ||
+ | </ | ||
+ | |||
+ | ===== 参考サイト ===== | ||
+ | |||
+ | * [[https:// | ||
+ | * 大変詳しい解説が載っている。 | ||
+ | * [[https:// | ||
+ |