Created
January 12, 2017 09:53
-
-
Save sstolz/363a5754c159f6d2bff9db260547c061 to your computer and use it in GitHub Desktop.
Wipe linux device with progress bar
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/bash | |
# resource | |
# https://wiki.archlinux.org/index.php/Securely_wipe_disk | |
dev="/sys/block/sda" | |
sector_number=$(cat ${dev}/size) | |
sector_size=$(cat ${dev}/queue/logical_block_size) | |
size=$((${sector_number} * ${sector_size})) | |
# Fast wipe | |
echo "dd if=/dev/zero | pv --size ${size} | dd seek=0 of=${dev} bs=${block_size} count=${block_count} oflag=\"direct\"" | |
# Wipe with random, should avoid data remanence for paranoïds | |
echo "dd if=/dev/urandom | pv --size ${size} | dd seek=0 of=${dev} bs=${block_size} count=${block_count} oflag=\"nocache\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment