Last active
November 23, 2021 10:41
-
-
Save dagar/8d002760ee1f8e76d1bd88c16a469d24 to your computer and use it in GitHub Desktop.
linux_sdcard_test_and_format.sh
This file contains 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 | |
# assumes /dev/sdb is sd card | |
# make sure it's not mounted | |
sudo udisksctl unmount --block-device /dev/sdb | |
sudo time badblocks -svw -t random /dev/sdb | |
sudo time f3probe --destructive --time-ops /dev/sdb | |
sudo parted --script /dev/sdb mklabel msdos | |
sudo parted --script /dev/sdb mkpart primary fat32 1MiB 100% | |
sudo time mkfs.vfat -c -v /dev/sdb1 | |
sudo parted /dev/sdb --script print | |
sudo time fsck.vfat -a -t -v -V /dev/sdb1 | |
sudo udisksctl power-off --block-device /dev/sdb1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment