0

I have a couple of computers that have multiple drives in them. I have Ubuntu on a USB drive that and right now using the shred option I need to manually run the shred command for each HDD/SSD myself.

Is it possible that it does that shred automatically for all the drives that it has, except for the USB that Ubuntu is running from?

karel
  • 110,292
  • 102
  • 269
  • 299

1 Answers1

0

Shred all physical disks?

Get the disks list with something like lsblk -S | grep disk | cut -d " " -f 1 then run the a loop against this list

#!/bin/bash
## get disks list
DisksList=$(lsblk -S | grep disk | cut -d " " -f 1)
## Loop from https://askubuntu.com/a/786171/77093
for d in $DisksList ; do
    ## shred --your-options-here /dev/$d 2>&1 >shred.$d.log &
    # example of a shred command options, no log, one thread
    shred -vfz -n 1 /dev/$d
done
cmak.fr
  • 8,411
  • 2
  • 29
  • 45