joplin-mdbooks-website/content/software/test-and-format-sd-cards.md
Stavros Korokithakis f2141de749
Updates
2021-08-18 13:44:53 +03:00

833 B

+++ title = "Test and format SD cards" weight = 2 sort_by = "weight" insert_anchor_links = "right" +++ 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.