F5F Stay Refreshed Software Operating Systems Linux clean wipe?

Linux clean wipe?

Linux clean wipe?

R
Raidex20
Posting Freak
751
02-21-2025, 04:13 AM
#1
I don't have access to a direct command for that, but you can use tools like `dd` or `shred` via terminal. For example:

```bash
sudo dd if=/dev/zero of=/dev/sdX bs=4M status=progress
```
Replace `/dev/sdX` with your disk identifier. For a full wipe, you may need to combine commands or use system tools specific to your distro.
R
Raidex20
02-21-2025, 04:13 AM #1

I don't have access to a direct command for that, but you can use tools like `dd` or `shred` via terminal. For example:

```bash
sudo dd if=/dev/zero of=/dev/sdX bs=4M status=progress
```
Replace `/dev/sdX` with your disk identifier. For a full wipe, you may need to combine commands or use system tools specific to your distro.

C
CreePxSh0tz
Junior Member
45
02-21-2025, 07:12 AM
#2
Hello, From an arch live setup: You can launch a terminal and execute: Command: lsblk This will display your installed storage devices. To erase a drive, run: Command: shred -vfz -n 3 /dev/sdx A note: The "x" stands for your installation disk, such as sda. The command will overwrite the drive three times—twice with random data and once with all zeros. If you don’t mind fully clearing the drive, try: Command: cfdisk /dev/sdx A note: The "x" also refers to your install disk, e.g., sda. From the menu, choose partitions, remove them, and save your changes.
C
CreePxSh0tz
02-21-2025, 07:12 AM #2

Hello, From an arch live setup: You can launch a terminal and execute: Command: lsblk This will display your installed storage devices. To erase a drive, run: Command: shred -vfz -n 3 /dev/sdx A note: The "x" stands for your installation disk, such as sda. The command will overwrite the drive three times—twice with random data and once with all zeros. If you don’t mind fully clearing the drive, try: Command: cfdisk /dev/sdx A note: The "x" also refers to your install disk, e.g., sda. From the menu, choose partitions, remove them, and save your changes.

T
TDAL_NYKO
Member
65
02-23-2025, 05:01 PM
#3
Do this carefully; ensure the last bootable drive is the one being erased, or you'll lose your operating system. For solid-state drives, using tools like DBAN remains a viable choice.
T
TDAL_NYKO
02-23-2025, 05:01 PM #3

Do this carefully; ensure the last bootable drive is the one being erased, or you'll lose your operating system. For solid-state drives, using tools like DBAN remains a viable choice.

C
CaptainPanda
Junior Member
4
02-25-2025, 04:06 PM
#4
It's easy to choose a straightforward dd wipe.
C
CaptainPanda
02-25-2025, 04:06 PM #4

It's easy to choose a straightforward dd wipe.

M
MMASTER7
Member
227
03-04-2025, 05:16 AM
#5
Only the most advanced users should handle such tasks.
M
MMASTER7
03-04-2025, 05:16 AM #5

Only the most advanced users should handle such tasks.

T
TheTrueGeek
Member
217
03-05-2025, 12:24 AM
#6
You say "all hard drives" .... well, of course that depends on how many hard drives you have and sometimes even on what type they are. All advices already given are sound. In short, to account for ALL hard drives, something like this will work for most systems : for HARDDISK in /dev/sd? ; do dd if=/dev/zero of=$HARDDISK ; done But, this command, too, will also erase the running OS. It should work if you tweak the command so that the hard disk with the OS is the last erased (or exclude it!). While erasing the running OS, you might run into something like a Kernel Panic which might interrupt the erase. Just to keep my sanity, I'd do this kind of operations from some other live enviroment (USB / CD / DVD / network bootable Linux). I don't like to pull out the carpet of a running OS, but in case you are on a OS killing mission, I suppose it wouldn't matter A bit of background: all SATA ( EDIT: this is not conclusive - usually also USB, and possibly others are here!) drives are named as /dev/sdX (where X is a, b, c, d etc.); partitions are sdXN, where N is the partition number. With the above command you will be writing all /sd? with zeroes ( EDIT: it will take quite a long time - depending on the size of the disks!). But it can be the case, there are other hard drives besides /dev/sdX; for example, M.2 NVME disks will be named /dev/nvmeAnB - and there's no reason there couldn't be others. In case you haven't tinkered with your distribution and don't use exotic hardware, you are good. Historically, hard disks were named /dev/hdX (IDE drives) and the device nodes could be renamed various ways. To make sure, you might want to run commands such as "lsblk" and "blkid" as root, to see what block devices the Kernel has found on the running system. Also, there are different ways to erase. If you just want to erase partitions, removing the label is enough (i.e. the first 512 bytes should do, for DOS partition tables and probably GPT too, though I'm not sure - just increase to few kilo-megabytes and every disk label will be erased for sure). If you want to do it securely, i.e. make impossible to retrieve files, then DDing zeros to the whole disk is enough for civilian usage, but in case the hard disks contain secrets which might interest the FBI, NSA, CIA, KGB or some industrial espionage organizations, that might not be enough ( EDIT: The shred command suugested by @dhumes05 will probably be enough, or at least make it very difficult / infeasible to retrieve data even in a very advanced laboratory). Also, SSDs are another thing altogether (use some TRIM command to actually erase it, wear leveling might preserve data even though one thinks it is erased). EDITX: Talking bout secure erasing ....
T
TheTrueGeek
03-05-2025, 12:24 AM #6

You say "all hard drives" .... well, of course that depends on how many hard drives you have and sometimes even on what type they are. All advices already given are sound. In short, to account for ALL hard drives, something like this will work for most systems : for HARDDISK in /dev/sd? ; do dd if=/dev/zero of=$HARDDISK ; done But, this command, too, will also erase the running OS. It should work if you tweak the command so that the hard disk with the OS is the last erased (or exclude it!). While erasing the running OS, you might run into something like a Kernel Panic which might interrupt the erase. Just to keep my sanity, I'd do this kind of operations from some other live enviroment (USB / CD / DVD / network bootable Linux). I don't like to pull out the carpet of a running OS, but in case you are on a OS killing mission, I suppose it wouldn't matter A bit of background: all SATA ( EDIT: this is not conclusive - usually also USB, and possibly others are here!) drives are named as /dev/sdX (where X is a, b, c, d etc.); partitions are sdXN, where N is the partition number. With the above command you will be writing all /sd? with zeroes ( EDIT: it will take quite a long time - depending on the size of the disks!). But it can be the case, there are other hard drives besides /dev/sdX; for example, M.2 NVME disks will be named /dev/nvmeAnB - and there's no reason there couldn't be others. In case you haven't tinkered with your distribution and don't use exotic hardware, you are good. Historically, hard disks were named /dev/hdX (IDE drives) and the device nodes could be renamed various ways. To make sure, you might want to run commands such as "lsblk" and "blkid" as root, to see what block devices the Kernel has found on the running system. Also, there are different ways to erase. If you just want to erase partitions, removing the label is enough (i.e. the first 512 bytes should do, for DOS partition tables and probably GPT too, though I'm not sure - just increase to few kilo-megabytes and every disk label will be erased for sure). If you want to do it securely, i.e. make impossible to retrieve files, then DDing zeros to the whole disk is enough for civilian usage, but in case the hard disks contain secrets which might interest the FBI, NSA, CIA, KGB or some industrial espionage organizations, that might not be enough ( EDIT: The shred command suugested by @dhumes05 will probably be enough, or at least make it very difficult / infeasible to retrieve data even in a very advanced laboratory). Also, SSDs are another thing altogether (use some TRIM command to actually erase it, wear leveling might preserve data even though one thinks it is erased). EDITX: Talking bout secure erasing ....

R
Rhuji
Senior Member
437
03-06-2025, 01:14 PM
#7
Ensure all data is cleared by starting a live Linux environment and mounting/erasing the storage devices to avoid any issues with the kernel.
R
Rhuji
03-06-2025, 01:14 PM #7

Ensure all data is cleared by starting a live Linux environment and mounting/erasing the storage devices to avoid any issues with the kernel.