Skip to content

Instantly share code, notes, and snippets.

@rgov
Last active February 14, 2024 18:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgov/e029e97c294df7eba2c864919564fd0d to your computer and use it in GitHub Desktop.
Save rgov/e029e97c294df7eba2c864919564fd0d to your computer and use it in GitHub Desktop.
#!/bin/bash -eu
# remount-circuitpy.sh -- remount a FAT disk, usually CIRCUITPY, so it works
#
# Works around bug where macOS 14.x causes file corruption on small FAT
# filesystems. The remount apparently causes older kernel FAT driver
# to be loaded. see https://github.com/adafruit/circuitpython/issues/8449
#
# Original author: Tod Kurt @todbot
DISKNAME=${1:-CIRCUITPY}
DISKDEV=$(df | grep "$DISKNAME" | cut -d" " -f1)
sudo umount "/Volumes/${DISKNAME}"
sudo mkdir "/Volumes/${DISKNAME}"
sleep 2
sudo mount -v -t msdos "$DISKDEV" "/Volumes/${DISKNAME}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment