this post was submitted on 02 Aug 2025
5 points (100.0% liked)

Raspberry Pi

2607 readers
17 users here now

Welcome to the programming.dev Raspberry Pi community!

Raspberry Pi is a series of small single-board computers. It is widely used in many areas because of its low cost, modularity, and open design. It is typically used by computer and electronic hobbyists.

Rules

Members of this community are expected to exhibit mature and respectful behavior.

Those who fail to uphold these standards may find their posts or comments removed, with repeat offenders potentially facing a permanent ban.

Please keep discussions in English so that they can be appropriately moderated.

Links

founded 2 years ago
MODERATORS
 

I have a pile of hard drives sitting around that need to be securely wiped. Does anyone know of something similar to DBAN or ShredOS for ARM that I can use to turn a Pi into a disk wipe station? It doesn't need to be a dedicated OS, just a package that I can run on top of armbian or whatever.

top 7 comments
sorted by: hot top controversial new old
[–] Dumhuvud@programming.dev 2 points 6 hours ago

Arch Wiki has a rather decent article about wiping disks: https://wiki.archlinux.org/title/Securely_wipe_disk

Assuming your Pi runs a Linux distro, most of those tools should be already present on your system.

[–] SpikesOtherDog@ani.social 3 points 12 hours ago (1 children)

Yes! You can use SATA secure erase features. Give me a few and I'll post a brief set of commands.

[–] SpikesOtherDog@ani.social 5 points 11 hours ago* (last edited 11 hours ago) (1 children)

OK, to be clear, you can boot to raspbian or your distro of choice and use hdparm if you have a proper SATA controller and connection. This does not work on NVME drives.

#shred

If you have a spinning disk and either are forced to use a USB to SATA adapter or if the drive itself does not support secure erase, then you can use the shred command.

shred -fv /dev/sdb

will write random data to the sata device sdb. f is for force and v is for verbose. You can add z to add an extra zero pass and z to change the number of passes. That means that

shred -z -n 5 /dev/sdb

should do 5 passes and then zero on drive sdb

It will ALSO work for older parallel drives that identify as hd or that still appear as sd with a USB adapter. You had better check your devices with a lsblk before you run it. It will probably overwrite the OS of a running system.

Last word on shred is that it is ungodly slow. One pass of 1 tb takes 1.5 to 3 hours.

#hdparm

For SATA drives that support it, you can use hdparm. A deep explanation of what I'm doing is available here: https://grok.lsu.edu/article.aspx?articleid=16716. I could write out how to do it, but it goes into greater detail.

For forcing the system to sleep, you may need to

echo disk | sudo tee /sys/power/state

Also, be sure to set a password when prompted. If you omit the password, you may brick the drive. I have rarely been able to unbrick a drive.

This process may take several hours. The output of hdparm -I (that is an uppercase i) should tell you how long.

#NVME

Check processes here: https://wiki.archlinux.org/title/Solid_state_drive/Memory_cell_clearing#NVMe_drive

I have followed them once upon a time, but i haven't done it in years and cannot offer solid advice.

[–] Fuck_u_spez_@sh.itjust.works 1 points 8 hours ago (1 children)

Very helpful, thank you! One question on this:

a proper SATA controller and connection

Are we just talking about a SATA hat here?

[–] SpikesOtherDog@ani.social 1 points 6 hours ago

I'm not familiar with the hat, you can always run hdparm /I against the drive and see what the output is.

[–] actionjbone@sh.itjust.works 2 points 12 hours ago* (last edited 11 hours ago) (1 children)

It's funny, I was about to post a reply to help - but I looked up my answer (just to me sure), and it turns out I was wrong!

So I'm learning something here, too. Bookmarked so I can see what Spikes posts later

[–] SpikesOtherDog@ani.social 2 points 11 hours ago* (last edited 6 hours ago)

Turns out my comments were not brief, but once you get the hang of it you can write down the commands you are using and repeat them.

I scripted the whole thing for work, so it is getting more and more rusty.