HDDやSSDのパーティションを削除したい時には、「ディスクの管理」からパーティションを削除するが、「回復パーティション」などはディスクの管理からでは削除することが出来ない。
そんなときには、diskpartコマンドを利用すると簡単にパーティションを削除することが出来るので、その方法を解説します。
消せないパーティションの例
以下のような「回復パーティション」などはディスクの管理からは削除することが出来ません。
![ディスクの管理で削除出来ないパーティション](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-01.png)
通常のパーティションであれば右クリックで「ボリュームの削除(D)…」というメニューが出るのですが、この「ディスク1」の「回復パーティション」の右クリックメニューには「ヘルプ(H)」しか無いので何も操作が出来ないという状態になります。
![「ボリュームの削除(D)...」が無い](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-02.png)
このようなケースでは、以下の2通りの対策方法があります。
- diskpartコマンドを利用して「特定のパーティションのみ」を削除する。
- diskpartコマンドを利用して「ディスク内データを丸ごと」全消去する。(※ディスク内のパーティションも同時に削除されます。)
というわけで、それぞれの方法を解説していきます。
diskpartコマンドで特定のパーティションのみを削除したい場合
コマンドプロンプトもしくはWindows PowerShellを管理者権限で開く
まず、コマンドプロンプトもしくはWindows PowerShellを管理者権限で開きます。
![コマンドプロンプトを管理者権限で開く](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-03.png)
diskpartコマンドを対話形式で実行(パーティションの削除)
diskpart
と入力してEnterキーを押します。(※diskpart起動)
![diskpartと入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-04.png)
list disk
と入力してEnterキーを押します。(※ディスク情報一覧を表示)
![list diskと入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-05.png)
今回は「ディスク1」の「回復パーティション」を削除したいので、
select disk 1
と入力してEnterキーを押します。(※ディスクを選択)
![select disk 1と入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-06.png)
存在するパーティションの情報を確認したいので
list partition
と入力してEnterキーを押します。(※パーティション情報一覧を表示)
![list partitionと入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-07.png)
パーティション一覧が表示されるので「回復」となっているパーティションの番号を見つけます。
今回はパーティション1なので
select partition 1
と入力してEnterキーを押します。(※パーティションの選択)
![select partition 1と入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-08.png)
パーティションが正しく選択されたかの確認のため、もう一度
list partition
と入力してEnterキーを押します。(※パーティション情報一覧を表示)
![もう一度 list partitionと入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-09.png)
削除したいパーティションの左に「*」マークが付いていることを確認し、問題無ければ、
delete partition override
と入力してEnterキーを押します。(※パーティション削除)
![delete partition overrideと入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-10.png)
パーティションが削除されました。
![パーティションの削除完了](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-11.png)
削除が正常に終了したら
exit
と入力してEnterキーを押し、diskpartを終了します。(※diskpart終了)
![exitと入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-12.png)
もう一度
exit
と入力してEnterキーを押し、コマンドプロンプトを閉じれば終了です。
![exitと入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-13.png)
パーティションが削除されたか確認
ディスクの管理にてパーティションが正常に削除されたか確認します。
![ディスクの管理にてパーティションの削除を確認](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-14.png)
正常にパーティションが削除され、「未割り当て」になりました。
diskpartコマンドでディスク内データを丸ごと全消去したい場合
例として以下のディスク1のデータを全消去します。
![diskpartコマンドでディスク内データを全消去する前の状態](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-15.png)
コマンドプロンプトもしくはWindows PowerShellを管理者権限で開く
コマンドプロンプトもしくはWindows PowerShellを管理者権限で開きます。
![コマンドプロンプトを管理者権限で開く](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-03.png)
diskpartコマンドを対話形式で実行(ディスク内データの全消去)
diskpart
と入力してEnterキーを押します。(※diskpart起動)
![diskpartと入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-16.png)
list disk
と入力してEnterキーを押します。(※ディスク情報一覧を表示)
![list diskと入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-17.png)
今回は「ディスク1」内のデータを丸ごと全消去したいので、
select disk 1
と入力してEnterキーを押します。(※ディスクの選択)
![select disk 1と入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-18.png)
ディスク1が正しく選択されたかの確認のため、もう一度
list disk
と入力してEnterキーを押します。(※ディスク情報一覧を表示)
![list diskと入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-19.png)
データを全消去したいディスクの左に「*」マークが付いていることを確認し、問題無ければ、
clean
と入力してEnterキーを押します。(※ディスク内情報の全消去)
![cleanと入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-20.png)
ディスク内データが全消去されました。
![ディスク内データの全消去完了](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-21.png)
exit
と入力してEnterキーを押し、diskpartを終了します。(※diskpart終了)
![exitと入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-22.png)
もう一度
exit
と入力してEnterキーを押し、コマンドプロンプトを閉じれば終了です。
![exitと入力してEnter](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-23.png)
ディスク内データの全消去が完了したか確認
ディスクの管理にてディスク内データの全消去が正常に完了したかを確認します。
![ディスク内データの全消去後の状態](https://onoredekaiketsu.com/wp-content/uploads/2022/08/delete-partitions-that-cannot-be-deleted-with-diskpart-command-24.png)
正常にディスク内データが全消去され、ディスクが「初期化されていません」になり、パーティション情報も全て削除されました。
まとめ
ディスクの管理から削除できないパーティションを削除したい場合は、以下のどちらかの方法でパーティションを削除しましょう。
- diskpartコマンドの「delete partition override」を利用して「特定のパーティションのみ」を削除する。
- diskpartコマンドの「clean」を利用して「ディスク内データを丸ごと」全消去する。(※ディスク内のパーティションも同時に削除されます。)
尚、diskpartは強力なコマンドなので、実行する場合は指定するディスクやパーティションを間違わないように気を付けましょう。
以上で解決です。