Wiping a disk or partition in Linux removes the existing filesystem metadata and overwrites the target before it is reused, repartitioned, or handed to another system. That matters when deleting files or running a quick format is not enough to stop normal reads of the old contents.

Linux exposes storage as block devices such as /dev/sdb, /dev/nvme1n1, and partitions such as /dev/sdb1. The flow below uses lsblk to confirm the chosen target, wipefs to show the signatures that are about to be erased, dd to write zeros across the entire device, and a short readback plus a second wipefs check to confirm that the old metadata is gone.

The commands were verified on Ubuntu 24.04 with a loop-backed ext4 device, but the same zero-overwrite path applies to ordinary disks and partitions on current Linux systems. The target must be unmounted first, the running root or boot disk must be handled from live or rescue media, and a wrong of= path in dd erases the wrong device immediately.

Steps to wipe a disk or partition in Linux:

  1. Display the chosen target device and its current mount point before wiping it.
    $ lsblk -o NAME,PATH,SIZE,TYPE,FSTYPE,MOUNTPOINTS /dev/loop6
    NAME  PATH       SIZE TYPE FSTYPE MOUNTPOINTS
    loop6 /dev/loop6  64M loop        /mnt/wipe-demo

    Replace /dev/loop6 with the disk or partition that should be wiped. Use a whole-disk path such as /dev/sdb or /dev/nvme1n1 to erase an entire drive, or a partition path such as /dev/sdb1 when only one partition should be wiped.

  2. Inspect the current filesystem or partition-table signatures before overwriting them.
    $ sudo wipefs --output DEVICE,OFFSET,TYPE,UUID,LABEL /dev/loop6
    DEVICE OFFSET TYPE UUID                                 LABEL
    loop6  0x438  ext4 3d25503f-a42a-4b27-a600-2c854257bb9e wipe-demo

    This confirms that the target still exposes recognizable metadata. If wipefs prints no data rows here, the device may already be blank from a previous wipe or format.

  3. Unmount the target device before writing over it.
    $ sudo umount /dev/loop6

    If the target is a whole disk, unmount every mounted child partition on that disk first. If the target is the running root filesystem, a boot volume, or another busy live device, stop here and continue from live or rescue media instead of forcing the wipe from the active system.

  4. Overwrite the entire target with zeros.
    $ sudo dd if=/dev/zero of=/dev/loop6 bs=4M status=progress conv=fsync
    dd: error writing '/dev/loop6': No space left on device
    17+0 records in
    16+0 records out
    67108864 bytes (67 MB, 64 MiB) copied, 0.0856923 s, 783 MB/s

    The final No space left on device line is expected when dd reaches the end of the disk or partition. The important result is that the reported bytes copied match the full size of the target.

    conv=fsync flushes the final data and metadata writes before dd exits, which makes the verification step more reliable on a freshly wiped device.

  5. Confirm that the wipe removed the visible signatures from the device.
    $ sudo wipefs --noheadings /dev/loop6

    Blank output means wipefs no longer sees a filesystem, RAID, or partition-table signature on the target. wipefs is being used here as a verification command, not as the wipe method.

  6. Sample the first bytes of the device to confirm that the overwrite starts with zeros.
    $ sudo dd if=/dev/loop6 bs=64 count=1 status=none | od -An -tx1
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    *

    All-zero readback is a quick spot check after the overwrite. The decisive success state is still the full-device dd write plus blank wipefs output, because a short readback only samples one small part of the disk.