joplin-mdbooks-website/content/software/test-and-format-sd-cards.md
Stavros Korokithakis 4caaff6c90 Migrate to mdBook
2021-11-20 02:13:37 +00:00

758 B

Test and format SD cards

I wrote a short bash script that tests SD cards with F3 to see if they're fake, deletes everything on them, creates a new partition table and one exFAT partition on them.

Here it is:

#!/usr/bin/env bash

set -euox pipefail

sudo umount --force "$1"1 || true
sudo f3probe --destructive --time-ops "$1"
sudo parted --script "$1" "mklabel msdos" "mkpart primary ext4 0% 100%"
sleep 1
sudo mkfs.exfat -n Stavros "$1"1
eject "$1"

Save it as formatsd.sh and run it as ./formatsd.sh /dev/sdX.


Last updated on August 18, 2021. For any questions/feedback, email me at hi@stavros.io.