Partitioning and formatting an external USB drive to FAT32 filesystem will make it usable in many devices or OS (Linux, Mac, Windows and Android).
The OS I chose is Debian, but it will work in any Debian derived OS, including Ubuntu, Raspbian OS, Linux Mint and so on.
Any of the commands below will run in command line (CLI) and they work with desktop and server environments.
The dosfstools
package contains the mkfs.fat
and fsck.fat
utilities, where the first one creates the MS-DOS FAT32 filesystem, while the second one checks and repairs the MS-DOS FAT32 filesystem.
If this package is not installed, you can install it by running:
apt update
apt install dosfstools
fdisk -l
In my case, the device is /dev/sdb
. Make sure it's the right device, or you can lose the data on it!
This step is required only if you want a different partition type or if the drive doesn't have a partition on it.
fdisk /dev/sdb
a. type d (delete) as many partitions there are
b. type n (new) and choose primary, then hit enter twice
c. type w (write)
d. type q (quit)
mkfs.vfat /dev/sdb1
sync
eject /dev/sdb1
Note: The partition must be unmounted before running the check command.
sudo fsck.fat /dev/sdb1
Resources: