# Zero a hard drive in Linux

You might want to check the drive to see if it is still good in the first place. Go here first: [Check hard drive for bad sectors](https://wiki.danicus.net/books/hardware/page/check-hard-drive-for-bad-sectors-in-linux "Check hard drive for bad sectors in Linux")

<div id="bkmrk-unmount-the-drive%3A-%28">1. Unmount the drive: (if you haven't already) ```bash
    sudo umount /dev/sdX*
    ```
    
    
    - Check with <span class="text-sm px-1 rounded-sm !font-mono bg-orange-400/10 text-orange-500 dark:bg-orange-300/10 dark:text-orange-200">lsblk</span> to confirm unmounting
2. Write zeros with progress:

</div>```bash
sudo dd if=/dev/zero of=/dev/sdX bs=4M status=progress
```

- <span class="text-sm px-1 rounded-sm !font-mono bg-orange-400/10 text-orange-500 dark:bg-orange-300/10 dark:text-orange-200">status=progress</span> displays transfer progress (e.g., bytes written).

**Verify drive identifier:**

<div id="bkmrk-"><div class="not-prose" dir="auto"><div class="relative [&_div+div]:!mt-0 mt-3 mb-3 -mx-4 -mr-2 @md:-mr-4"><div class="false flex flex-col gap-2">  
</div></div></div></div>Ensure <span class="text-sm px-1 rounded-sm !font-mono bg-orange-400/10 text-orange-500 dark:bg-orange-300/10 dark:text-orange-200">sdX</span> matches your drive to avoid data loss.