Last active
September 3, 2019 17:23
-
-
Save toreriklinnerud/5b1849c096808e94c472d2b17a1e56b2 to your computer and use it in GitHub Desktop.
On linux, for all connected drives under /dev/sd: unmount, wipe, format with exfat, mount
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 | |
set -e | |
set -o pipefail | |
for dev in /dev/sd? | |
do | |
if findmnt "${dev}1" | |
then | |
umount "${dev}1" | |
fi | |
wipefs $dev | |
printf "g\nn\n1\n\n\nt\n11\np\nw\n" | sudo fdisk "$dev" | |
sudo mkfs.exfat "${dev}1" | |
mkdir -p "/mnt${dev}" | |
mount "${dev}1" "/mnt${dev}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment