-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwipe
More file actions
executable file
·39 lines (33 loc) · 764 Bytes
/
Copy pathwipe
File metadata and controls
executable file
·39 lines (33 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /bin/bash
# Utility to wipe a harddrive
# Uses wipe and shred. Finally the drive is wiped clean with dd.
if (( $UID != 0 )); then
echo "Not root, exiting.."
exit 1
fi
if (( $# != 1 )); then
echo "ERROR: Missing device"
echo "Usage:$basename $0 device"
exit 1
fi
if ! command -v wipe &> /dev/null; then
echo "ERROR: wipe missing"
exit 1
fi
if ! command -v shred &> /dev/null; then
echo "ERROR: shred missing"
exit 1
fi
disk=$(fdisk -l $1 | grep $1 | head -n 1)
if [[ $disk != "" ]]; then
echo -n "Are you sure you want to wipe $disk? (y/n): "
else
echo "ERROR: $1 not found"
exit 1
fi
read answer
if [[ $answer == "y" ]]; then
sudo wipe -q $1
sudo shred -n 2 -vz $1
sudo dd if=/dev/zero of=$1
fi