Update README.md

This commit is contained in:
root 2024-01-03 11:08:17 +01:00
parent f82f0c50c3
commit 82645ecffc

View file

@ -1,3 +1,39 @@
# utility-format-usb.sh
Partition and format any USB device using **exFAT** filesystem.
## Description
The scripts partitions and formats any USB device using **exFAT** filesystem. To avoid accidental format of non removable devices a couple of safeguards exist.
The script will check if the supplied device is valid then it checks if the device is in fact a removable device. If any of these checks fail the script aborts.
The script will ask for user confirmation twice and default to abort on <kbd>Enter</kbd>
## Use case
Re-purpose the USB stick if you have flashed an ISO to it.
Why? Because writing an ISO using `dd` writes an ISO9660 filesystem to a small part of the USB - the rest is inaccessible.
## Instructions
Create the folder **~/.local/bin** and copy the file `format-usb.sh` into the folder, then make sure the file is executable.
```
mkdir -p ~/.local/bin
chmod +x ~/.local/bin/format-usb.sh
```
## Usage
Remove your USB if attached and list devices
lsblk
Insert your USB device and list the devices
lsblk
The new device in the list is your USB device e.g. /dev/sdy - format the device using the script
format-usb.sh /dev/sdy
## Note
What this script does can probably be done in numerous ways with numerous tools.
The **list contains** validation is taken from this [stackoverflow topic][1]