Comment on Proper HDD clear process?
thenumbersmason@yiffit.net 11 months ago
dd works fine, you’d use it something like this
dd if=/dev/zero of=/dev/ status=progress conv=fsync bs=4M
if: input file of: output file status=progress: shows progress
conv=fsync: basically does the equivalent of running “sync” after the command, makes sure all the kernel buffers have actually written out and are on the device. This causes the command to “hang” near the end depending on how much RAM is installed on the computer. It’s not actually hanging it’s just finishing writing out the data that’s still cached in RAM. This can take a while depending on drive speed and quantity of system RAM.
bs=4M sets the block size to something high enough you’re not CPU bottlenecked. Not particularly important exactly what the value is, 4M is a good sane default for most things including this full disk operation.
scrubbles@poptalk.scrubbles.tech 11 months ago
Thanks! I’ve used dd for things like recovering/cloning drives but it makes complete sense I can wipe it too. Thanks for the progress trick too, it was always just a blank cursor to me when I ran it before!
WaterWaiver@aussie.zone 11 months ago
I recommend using a different set of flags so you can avoid the buffering problem @thenumbersmason@yiffit.net mentions. This prevents all of your ram getting useless used up during the wipe (which causes things to run slower whenever they need more mem, I notice my web browser lags occasionally as a result), allows the progress to actually be accurate (disk write speed instead of RAM write speed) and prevents the horrible hang at the end.
dd if=/dev/urandom of=/dev/somedisk status=progress oflag=sync bs=128M
“oflat” means output flag (to do with of=/dev/somedisk). “sync” means sync after every block. I’ve chosen 128M blocks as an arbitrary number, below a certain amount it gets slower (and potentially causes more write cycles on the individual flash cells) but 128MB should be massively more than that.