Last active
May 27, 2019 09:02
-
-
Save changbowen/1b78bd5d93af8fc1e55ec0be18c3a0fb to your computer and use it in GitHub Desktop.
Wipe disk and check bad sectors
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
# check physical and logical sector size | |
lsblk -o Name,PHY-SEC,LOG-SEC | |
# wipe disk | |
sudo shred -v -n1 -z /dev/sdx | |
# check bad sectors (readonly) | |
sudo badblocks -vs -b 4096 -c 65536 /dev/sdx | |
# check bad sectors and wipe disk | |
# -t 0xaa limits pass to once instead of several due to -w switch | |
sudo badblocks -vsw -b 4096 -c 65536 -t 0xaa /dev/sdx | |
# unmount and power-off | |
udisksctl unmount -b /dev/sdx1 | |
udisksctl power-off -b /dev/sdx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment