You need to take 3 steps to prepare the USB stick. Before you start, make sure you know the correct drive letter (/dev/sd?) that is used by the system for the USB stick and replace the ? with that letter in the following commands.
If the USB stick is unmounted, let's open a terminal and let's start:
Step 1
Blank the beginning of the USB stick.
sudo dd if=/dev/zero of=/dev/sd? bs=4M count=1 && sync
Step 2
Create both a partition table and a partition on the drive.
sudo fdisk /dev/sd?
fdisk
will create an msdos/mbr partition table on the USB stick automatically.
Press n for new partition and if you want to create a single partition on the whole drive, you can accept the default selections in the questions that follow by simply pressing Enter. You can always consult the man pages by typing man fdisk
for further details on how to customize partitioning.
After you're finished with the new partition, press w to write the changes to the USB stick and close fdisk
.
Step 3
Format the partition you've created:
sudo mkfs.vfat -F 32 /dev/sd?
to create a FAT32 partition or,
sudo mkfs.ext4 /dev/sd?
to create an EXT4 partition for use with Linux only.
The USB stick should be ready to use at this point.
WARNING: If you don't use the correct drive letter on any of the commands shown above, another disk's data will be destroyed, possibly irrevocably.
man umount df
– waltinator May 02 '21 at 02:20