Skip to content

Instantly share code, notes, and snippets.

@watson0x90
Created April 23, 2026 12:53
Show Gist options
  • Select an option

  • Save watson0x90/b43bc66ee36e81eca7653db68076ecdc to your computer and use it in GitHub Desktop.

Select an option

Save watson0x90/b43bc66ee36e81eca7653db68076ecdc to your computer and use it in GitHub Desktop.
# Identify the internal drive
lsblk
# Wipe everything (replace /dev/sda with the correct device)
sudo wipefs -a /dev/sda
sudo sgdisk --zap-all /dev/sda
sudo dd if=/dev/zero of=/dev/sda bs=1M count=100
sudo dd if=/dev/zero of=/dev/sda bs=1M seek=$(( $(sudo blockdev --getsz /dev/sda) / 2048 - 100 ))
count=100
sudo sync
The first dd wipes the beginning (partition table, LVM headers), the second wipes the end (backup
GPT header, secondary LVM metadata). sgdisk --zap-all destroys both MBR and GPT structures. wipefs
-a removes all filesystem/RAID/LVM signatures.
After that, verify it's clean:
sudo fdisk -l /dev/sda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment