[[ solved ]]
I have a stack of SATA hard drives that I need to erase.
I have a USB drive dock, a box that a drive can be set into that connects to my computer via USB-3.
I am using DD to write zeros to the raw device, in this case, /dev/sdf.
No matter the actual size of the drive dd stops at about 3 to 7 gb. These are 300 gb to 3 TB drives.
I am not mounting the drives, but I do ensure they are visible to the system with lsblk. To change drives I turn off the dock. The drive then disappears from lsblk. When I insert a different drive and turn the dock back on again /dev/sdf re-appears.
Are all my drives bad? If they are I will need to have them “professionally” destroyed at about $25 a drive.
Next Update –
I started with a USB to SATA adapter that looked like a small box with a SATA connector on one edge and a USB cable coming out of one side, it had a power supply that connected to the small box - everything out in the open.
Then I went to a drive toaster - a dock where you slot the drive into a hole in the top of the dock, again powered and USB-3 (blue connector)
As of this update I have opened my USB-3 external drive and removed it’s native drive and put in one of the 1TB drives I wish to erase. I also switched to my production laptop. Now I have issued a dd command and it has written so far 28GB from /dev/urandom.
I think this will finally work. - I am marking this solved.
I prefer
shred
for erasing magnetic drives.dd
can work too, but its options are arcane enough that it’s easy to make mistakes that lead to weird behavior.If that doesn’t fix the unexpected size problem, I would suspect the USB bridge in your dock. Those things are notoriously buggy.
Connecting directly to the computer with SATA is a more reliable approach. It also lets you use
hdparm
to tell the drive to run a secure erase cycle on itself.No available sata ports remain.
Could be a bad dock or usb controller, try a different one. Otherwise just snap the sata connector off, and most people will not bother to get anything off.
Use the
shred
command instead. See https://www.freecodecamp.org/news/securely-erasing-a-disk-and-file-using-linux-command-shred/ for options on how to use it, for drives it’s a bit further down.Depending on the sensitivity of the data on the drives I would always suggest a “professional” shredding service that destroys the physical disk as well.
add with status=progress would be a good idea lace to start as the other commenter mentioned. Htop has a configuration in settings that will allow you to see disk writes as well.
There are also other options such as shred you can use.
using dd to zero a drive - is not a secure way to delete the data. It could potentially be recovered.
You mount filesystems, but you are accessing the device directly, so you are not using the filesystem, so no need to mount.
As the other comment mentions, it sounds like a controler issue. monitor the output of
sudo dmesg -w
as you are doing the work on them.need to have them “professionally” destroyed at about $25 a drive.
A Hammer is about $5 and will destroy them. :)
For the vast majority of people, writing zeroes to the disk is good enough. Even nation states and other advanced attackers would need a good amount of luck to get anything useful off a single pass zeroed HDD.
If you really need more than that, then there are various standards and recommendations for multiple passes of random/zeros/ones. Or just go the destructive route.
Of course SSDs are a totally different scenario. Writing zeroes is not sufficient or recommended for those. Generally, the secure erase command is the best way. However, this requires trusting that the firmware does that properly. If you don’t trust the firmware, destructive is the only option.
I don’t expect I am the target of a nation-state or large corporation.
Sometimes this is due to buggy UAS support. Look into blocking it globally or for your specific dock but check your logs first ideally.
I would suspect the cabling and/or the dock before all your drives.
Writing zeros to hard disk does not securely delete the contents. https://en.wikipedia.org/wiki/Gutmann_method
A further problem with writing zeros to the contents to
/dev/sdf/
is that contents of any relocated sectors will not be over-written. It might be possible to recover data from those bad sectors.If you can get the dock working, look at using
hpparm
to do SATA secure delete? It has flags to support this. https://www.putorius.net/securely-erase-a-sata-hard-drive-hdparm-linux.html You could then usehpparm
to set an unique, LONG, random password on each drive.Are you using /dev/zero as the input for dd, such as
dd if=/dev/zero of=/dev/<HD to erase>
? This is how I used to do this but I’ve recently switched to using the little tool ‘nwipe’ which allows to wipe multiple drives in parallel and show proper progress.Maybe there weren’t enough power going to the drives, is it a powered dock? Otherwise if you don’t need the drives anymore the good’ol hammer always works.
It is a powered dock.
Can you run dd with the “status=progress” option set to see what’s going on when it stalls? Also, how long until it stalls? In my experience, dd takes a really long time to write over an entire drive of that size, so you may just need to wait it out (could take a couple of days). You can also try increasing the block size (e.g., “bs=8m” or “bs=8M”, with the case of the “m” depending on your OS) and see if that helps to speed things along. Typically, the default dd block size (512 bytes) is pretty slow.
Note: I’m far from an expert but I have been using dd for similar applications as you for a few years. Hopefully something above can be of some help.
It completes normally but as though the drive is much smaller - it shows 3589 blocks in/out.
I mean, screwdriver to open and hammer for the platters works a charm, and is at least as secure as one pass of 0’s. Plus you can pull the magnets for whatever fun uses you can find later.
edit: Honestly even opening them and letting dust and other stuff in the air get on the platters pretty much destroys them… there’s a reason they are hermetically sealed.
Are all my drives bad?
It seems more likely that your usb adapter is at fault here …
I imagine that you’re filling the disk cache with the zeros and then it takes a while to actually write that to the disk - so be patient.
Have you tried securely erasing the disks using
hdparm
?Security-erase-enhanced complains of wrong ioctl , mayhap because the drive is attached by USB
By stops, you mean dd exits or hangs? Does dd throw an error/nonzero exit code? Anything in dmesg?
There’s no automatic mounting going on in the background, right?
Exits usually with disk full
It seems unlikely EVERY drive is bad in the exact same way. My money is on either the adapter having an issue (check dmesg for any usb errors?) or your USB port being marginal on providing enough power to run it, if it’s a bus-powered adapter.
Those really suck for mechanical drives and I’ve NEVER had good luck if that’s the case.