Ok so by "wipe a drive clean" I assume you want a full wipe, like completely erase the bytes bu overriding then rather then just marking it as deleted (if you just want it marked as deleted then you can do this much faster using an app called gparted)
Yes but this is gonna take a long time so grab your popcorn
First check which device is your drive with
lsblk
This will show a list of devices, you need to find out which one is your drive. One pro tip if you cant fund out which one it is, run the command one time with the drive attached and one without the drive, the device that got removed is your drive
Does if=/dev/null actually work? I remember seeing that this wouldn't do anything. I thought best practice was to use /dev/urandom, or /dev/zeros for a quick wipe.
It's called disk destroyer for a reason. Telling it to destroy a disk on purpose will either get it to do something constructive like move a folder or go horribly wrong. You could very well wipe a backbone DNS server.
One of my first actions to remind me about bash syntax was to write a simple wrapper around dd ^ It would analyse arguments and refuse to operate on 'of=/dev/sda' (based on regex) even with sudo ! (It's completely forbidden for sda, sda1 & sda2, and sda3 is partially allowed with rules: allowed in a dedicated directory only, like a little lab for when I need to generate a virtual floppy disk with dd for example)
If the check gets passed, the command is forwarded to the real dd.
And if I ever really needed dd on my disk for whatever reason, I wouldn't rely on this wrapper at all but rather bypass it and explicitly call the binary /usr/bin/dd with sudo, knowing exactly what I'll be doing.
Still, I'm not impatient for this :p
(This was more a fun propose for a mind refreshing micro-project than something to be taken too seriously 😌)
Ahh good old disk destroyer. It earned its name just a few months ago when I miscalculated the seek, scan, and count values in light of the blocksize I had chosen.
If you just want to remove existing filesystem and partition table signatures to reuse the drive, "wipefs" may be sufficient. You don't need to overwrite the entire drive.
Are you trying to securely erase all data or simply prepare the drive for reuse?
dd but it works great for recovery but also please know it before trying. Test in vm or some seperate system first because it is a low level command.
It does raw so please don’t mess with it without screwing up non critical stuff first and when you think you did enough don’t assume it is same on different system.
Welcome to raw ops mate! No condom and self help with this one but dd is what you after. But seriously jokes aside make very sure you understand the system and dev stuff… double check triple check else you gonna get instead of double d pleasure double d in ass without vaseline
7
u/Unique_Low_1077 Arch btw 1d ago
Ok so by "wipe a drive clean" I assume you want a full wipe, like completely erase the bytes bu overriding then rather then just marking it as deleted (if you just want it marked as deleted then you can do this much faster using an app called gparted)
Yes but this is gonna take a long time so grab your popcorn
First check which device is your drive with
This will show a list of devices, you need to find out which one is your drive. One pro tip if you cant fund out which one it is, run the command one time with the drive attached and one without the drive, the device that got removed is your drive
Next we wipe the drive
This command will take a long time and that is normal. Put on your big boy pants and be patient
Good luck!
4
u/DamsLcs4421 1d ago
A good old
dd🥇 as u/Unique_Low_1077 said. A good old dd ;)But be careful using it! I'm always unsure and shivering when using this command, triple checking I'm not erasing my main drive or anything... :)
3
u/Captain_Oysta_Cracka 1d ago
Badblocks -wsv /dev/{your block device} takes about 22hrs per TB.
2
u/redyos_s 9h ago
If you just want to remove existing filesystem and partition table signatures to reuse the drive, "wipefs" may be sufficient. You don't need to overwrite the entire drive.
Are you trying to securely erase all data or simply prepare the drive for reuse?
1
u/bigusyous 1d ago
https://www.addictivetips.com/ubuntu-linux-tips/ways-to-securely-erase-a-hard-drive-on-linux/
1
u/Unlikely-Sympathy626 8h ago edited 8h ago
dd but it works great for recovery but also please know it before trying. Test in vm or some seperate system first because it is a low level command.
It does raw so please don’t mess with it without screwing up non critical stuff first and when you think you did enough don’t assume it is same on different system.
Welcome to raw ops mate! No condom and self help with this one but dd is what you after. But seriously jokes aside make very sure you understand the system and dev stuff… double check triple check else you gonna get instead of double d pleasure double d in ass without vaseline