Created
November 19, 2022 10:19
-
-
Save click0/7cce32706fe0059101209a48347e9f6c to your computer and use it in GitHub Desktop.
HDD or SSD Disk Cleanup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# HDD or SSD Disk Cleanup | |
# Debian | |
disk_list=sda100 | |
disk_list=$(grep -E "nvme[0-9]+n[0-9]$|[hsv]d[a-z]$" /proc/partitions | awk '{print $4;}' | sed ':a;N;$!ba;s/\n/ /g') | |
for disk in ${disk_list}; do | |
[ ! -e "/dev/$disk" ] && { echo "disk $disk not found!"; exit; } | |
shred -vfz /dev/"$disk" | |
echo disk "$disk" is wipe! | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment