Blog | G5 Cyber Security

Securely Wipe SD Card Data

TL;DR

This guide shows you how to completely erase all data from an SD card using your computer. This is useful before selling, recycling or reusing the card. We’ll cover methods for Windows, macOS and Linux.

Securely Wipe SD Card Data

  1. Understand the Risks
  • Windows: Using Diskpart
    1. Connect your SD card to your computer using a card reader.
    2. Open Command Prompt as an administrator (search for ‘cmd’, right-click, and select ‘Run as administrator’).
    3. Type diskpart and press Enter.
    4. Type list disk and press Enter. Identify your SD card number carefully! (Look at the size to be sure.)
    5. Type select disk X (replace ‘X’ with the correct disk number) and press Enter. Double-check you have selected the right disk!
    6. Type clean and press Enter. This will erase the partition table.
    7. Type exit to leave Diskpart.
  • macOS: Using Disk Utility
    1. Connect your SD card to your computer.
    2. Open Disk Utility (Applications > Utilities).
    3. Select your SD card in the left sidebar. Be careful to select the correct disk!
    4. Click ‘Erase’ at the top of the window.
    5. Choose a name for the SD card (optional).
    6. Set the Format to MS-DOS (FAT32) or ExFAT, depending on your needs.
    7. Crucially, click ‘Security Options…’ and select ‘7-Pass Erase’. This performs multiple overwrites. This will take a long time.
    8. Click ‘Erase’ again to confirm.
  • Linux: Using `dd` (Advanced)
  • Warning: dd is powerful and can easily wipe the wrong disk if used incorrectly. Proceed with extreme caution.

    1. Connect your SD card to your computer.
    2. Identify your SD card device name (e.g., /dev/sdb). Use lsblk in a terminal to list block devices and identify the correct one based on size. Be absolutely sure you have the right device!
    3. Unmount the SD card if it’s mounted:
      sudo umount /dev/sdb1

      (replace ‘/dev/sdb1’ with your actual partition).

    4. Run dd to overwrite the entire disk. This example overwrites with zeros:
      sudo dd if=/dev/zero of=/dev/sdb bs=4M status=progress

      (replace ‘/dev/sdb’ with your SD card device name).

    5. Alternatively, use random data for a more secure wipe:
      sudo dd if=/dev/urandom of=/dev/sdb bs=4M status=progress

      . This is slower but more thorough.

  • Verification
  • Exit mobile version