ホーム 暮らし Complete HDD Data Erasure: Using DiskPart "Clean all" via PowerShell

Complete HDD Data Erasure: Using DiskPart "Clean all" via PowerShell

八木 麻衣 八木 麻衣 • 更新: • 公開: • 読了約 7 分
目次

Before giving away, selling, or disposing of a used HDD, you may want to "erase the data to a level where it cannot be recovered." I recently replaced the HDD in my home NAS, so I am going to delete the data on the old HDD.
In a Windows environment, DiskPart's clean all is simple and powerful. This overwrites the entire disk area with 0s (so-called "zero-filling"). I will share how to do this with everyone.

1. Confirm the target disk number

n6bd13f3f6da7

Search for "PowerShell" in the Start menu → Run as administrator.

First, display the list of connected disks.

Get-Disk | Sort-Object Number | Format-Table Number,FriendlyName,SerialNumber,Size,PartitionStyle,OperationalStatus

Here, check and note down the following for the HDD you want to erase:

  • Number (disk number)

  • Size (capacity)

  • FriendlyName / SerialNumber (model name/serial number)

Confirm and note these down.

Example: Suppose the disk you want to erase is Number = 2.

2. Overwrite the entire area with zeros using DiskPart (clean all)

Launch DiskPart in PowerShell (Administrator):

diskpart

Once DiskPart has started, enter the following in order.
Do not enter them all at once; execute the commands one line at a time by pressing "Enter." A dialog will appear, so proceed carefully while checking it!

list disk
select disk 2
detail disk
clean all
exit
Meaning of each command
  • list disk: List of connected disks

  • select disk 2: Select the target disk (*this is the most dangerous part)

  • detail disk: Display details of the selected disk (final check of capacity, model, etc.)

  • clean all: Overwrite the entire area with 0s for complete erasure

  • exit: Exit

3. Reusing after erasure (Optional)

Once clean all is finished, the HDD will be completely blank.
If you want to reuse it as a drive, run the following in PowerShell (Example: Initialize Disk 2 as GPT -> 1 partition -> NTFS).

Initialize-Disk -Number 2 -PartitionStyle GPT
New-Partition -DiskNumber 2 -UseMaximumSize -AssignDriveLetter |
  Format-Volume -FileSystem NTFS -NewFileSystemLabel "DATA" -Confirm:$false

Common points of caution (Potential pitfalls)

  • Do not select the disk containing the OS (usually Disk 0).

  • clean all takes time depending on the capacity (TB-class drives take quite a long time).

  • If using a laptop + external HDD, there is a risk of interruption if the USB connection is unstable.
    → Use a stable port/cable if possible.

Summary

If you want to erase an HDD in Windows to a level where recovery is difficult, start with this.

  • PowerShell (Administrator)

  • DiskPart

  • clean all (Zero-fill overwrite of the entire area)

Be careful when confirming the disk number. Let's proceed with safety first.

Recommended ORICO HDD case that I use


同じカテゴリの記事

八木 麻衣
トレンドリサーチャー 八木 麻衣
プロフィールを見る →

全記事の事実確認を担当。一次情報・公式発表・公開資料の三点を確認できない場合は公開を見送る判断をします。

おすすめの関連記事