this post was submitted on 01 Jul 2023
7 points (100.0% liked)

Linux

1259 readers
83 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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.

top 10 comments
sorted by: hot top controversial new old
[–] CrescentMadeJr 3 points 1 year ago* (last edited 1 year ago) (2 children)

Try mounting them. What is the dd command you’re using?

Now, depending on your threat model maybe a drill and a sledgehammer will be enough. If your threat model is rather high and it is really sensitive data, well you’ll have to spend that money if you can’t get zeros written.

[–] waspentalive@lemmy.one 2 points 1 year ago (1 children)

dd if=/dev/zero of=/dev/sdf bs=512 status=progress

[–] CrescentMadeJr 1 points 1 year ago

Yeah. That should do it. There is also a shred tool you could try.

sudo shred -vfz /dev/sdf

You can also write a zero file to see if the drive is useable. That won’t erase what’s on it, but it will write all free space. If you mount the drive and delete everything on it, a zero file will in theory write zeros to the whole drive.

mount /dev/sdf /media dd if=/dev/zero of=/media/zerofile.tmp

I have a similar threat model. If the disks are indeed bad then a nice sledge and a trip to an e-cycle location should do it.

[–] waspentalive@lemmy.one 2 points 1 year ago* (last edited 1 year ago) (1 children)

I am a private person without any state or corporate secrets in hand. I do not do online banking.

My threat model I believe is limited to random drive-by actors.

I was hoping to be able to provide these drives to others to use, the screwdriver and hammer will render them into E-waste. But on that issue, once the platter assembly is disassembled and the platers are separated and mixed up the data on them is probably not recoverable? With the given that each drive has multiple platters.

[–] zkikiz@lemmy.ml 0 points 1 year ago

A few gigs of zeroes will prevent random drive-bys. At that point the partition and filesystem table of at least the first partition is overwritten and you "can" recover files off it but you'll be missing filenames and at least half the files will be corrupt due to fragmentation losing track of which files are where.

I agree with Ono that shred is a good tool for this. If you don't want to use that, try increasing the block size to at least 1M if not 16M to reduce the overhead.

[–] kool_newt 1 points 1 year ago (1 children)

Are these ssd or rotational? SSD will typically have a firmware erase, look into SMART.

[–] BaelfireNightshd 1 points 1 year ago (1 children)

Most HDDs also have a firmware erase. Just it’s significantly slower than an SSD. The big issue is many USB SATA docks don’t support sending the commands.

[–] kool_newt 1 points 1 year ago
[–] ono@lemmy.ca 1 points 1 year ago* (last edited 1 year ago)

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 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.

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.