Use Linux to overwrite a HDD with random data

in hive-196037 •  4 years ago  (edited)


How to write over a harddisk with random data in Linux.

Commands used;
Generate Luks password with

dd if=/dev/urandom bs=1 count=32 | base64

cryptsetup luksFormat /dev/{Your Device Here}

Type YES in all caps

Enter LUKS passphrase: [Generated Password From Earlier]

cryptsetup luksOpen /dev/{Your Device Here} {Name to Map Drive}

dd if=/dev/zero of=/dev/mapper/{Name to Map Drive} bs=1M

when you see
dd: writing `/dev/mapper/...': No space left on device
disk is full

cryptsetup luksClose {Name to Map Drive}

cryptsetup luksDump /dev/{Your Device Here}

Look for payload or area "offload" number
Or just guess 2056 or 32768

dd if=/dev/urandom of=/dev/{Your Device Here} bs=512 count={Offset number}

You are done.

research link
https://www.linuxglobal.com/quickly-fill-a-disk-with-random-bits-without-dev-urandom/


▶️ DTube
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!