← Privacy & toolswipe a drive properly before you sell it

wipe a drive properly before you sell it

$shred -v -n 1 -z

why "delete" doesn't actually delete anything

when you drag a file to the trash or hit format, your computer isn't erasing the data. it's just removing the pointer that says "this data is here." the actual 1s and 0s sit on the disk until something else happens to overwrite them. that laptop you sold last year? if the buyer knows what they're doing, your tax documents and browser history might still be sitting right there, fully recoverable with free tools. this is how people end up with their old identity theft horror stories starting with "i just sold my old computer on marketplace."

step one: figure out what kind of drive you actually have

hdds and ssds get wiped completely differently, so you need to know which one you're dealing with before you do anything. on linux, run this:

lsblk -d -o NAME,ROTA

the ROTA column tells you the story. a 1 means it "rotates," that's your spinning hard drive. a 0 means no moving parts, that's your ssd or nvme drive. this matters because the wrong method either wastes your time or, worse, doesn't actually erase anything on an ssd.

wiping a spinning hdd with shred

hdds store data magnetically on physical platters, so overwriting the data with garbage actually destroys the original. that's what shred does:

shred -v -n 1 -z /dev/sdX

breaking it down:

-v gives you verbose output so you can watch progress instead of staring at a blank terminal wondering if it's frozen.

-n 1 means one pass of random data. people used to do 7+ passes because of old cold war era paranoia about magnetic remanence, but one good pass of random data is plenty for any realistic threat model today. more passes just burns time and wears the drive for no real benefit.

-z adds a final pass of all zeros, so the drive looks cleanly blank instead of full of random noise, which is a little less suspicious looking and a nice final touch.

replace /dev/sdX with your actual device name, not a partition number like sdX1. you want the whole disk.

wiping an ssd the right way

here's the part people get wrong constantly: shred does not reliably work on ssds. ssds use wear leveling, which spreads data across cells and remaps blocks behind the scenes to extend the drive's lifespan. this means when you "overwrite" a file, the ssd controller might actually write that overwrite to a completely different physical cell, leaving the original data untouched somewhere else on the chip. running shred on an ssd can give you false confidence while your real data sits there fine.

instead, use the drive's own built in secure erase command. for nvme drives:

nvme format /dev/nvme0n1 --ses=1

this tells the drive's own controller to wipe itself at the hardware level, which is the only method that accounts for wear leveling correctly. for sata ssds, look into hdparm's --security-erase option, which does the same job through a different interface.

what to do on windows and mac

you don't need to boot into linux for this. windows has a "reset this pc" option that can be set to fully wipe the drive rather than just removing apps, and modern windows machines with bitlocker enabled make this fast and genuinely secure because the data was already encrypted, so wiping the encryption keys makes the old data unreadable garbage. same idea on a mac: make sure filevault is turned on before you wipe, then do a full erase through the recovery options. encryption plus a wipe is a much stronger combo than a wipe alone.

the one step that actually matters most

before you run any of these commands, triple check the device name. shred and nvme format don't ask "are you sure," they just do what you told them. wiping the wrong drive because you mistyped sdb instead of sda is a classic, career ending mistake for sysadmins, and an "i just lost my family photos" mistake for everyone else. run lsblk again right before you pull the trigger and confirm the size and name match the drive you actually intend to destroy.

the takeaway

deleting and formatting leave your data recoverable, full stop. if you're getting rid of a drive, match the wipe method to the hardware: shred for spinning disks, secure erase for ssds, and a full encrypted reset for windows and mac machines. do this before every sale, donation, or recycling trip, and send this to whoever in your life is about to post "selling my old laptop, barely used" without a second thought.

watch the reel ↗
the weekly drop

one command a week that makes you harder to hack.

a single tool, explained in plain english, every week. straight to your inbox.

no spam. one email a week. unsubscribe anytime.