How to format a USB flash drive?
You can use Disks it's installed by default and easy to use.
- 1st: Click on the Dash icon
- 2nd: Search for "Disks"
- 3rd: Click on Disks
The application will shows up:
- 1st: Choose the USB flash drive
- 2nd: Click on the "gear" icon and choose "Format"
This little window will appear, just choose the option you want and click on Format...:
In Ubuntu there are many methods by which you can format your pen drive.
1 With the Disks utility
see the video
This is the simplest way.
2 With GParted
see the video
You can install it
from Ubuntu Software Center or
on the command-line:
sudo apt install gparted
3 On the command line
see the video
To show the USB drive among all storage partitions and volumes on your computer use:
lsblk
You can also use:
df
Suppose it may be
/dev/sdy1
. Unmount it with:sudo umount /dev/sdy1
To format drive with the FAT32 file system format:
sudo mkfs.vfat -F 32 /dev/sdy1
To set a file system label for your pen drive in the process:
sudo mkfs.vfat -F 32 -n 'name_for_your_pendrive' /dev/sdy1
You must include the
-F 32
part to specify the FAT size, it is not 32 by default in ubuntu 19.10. For more info seeman mkfs.fat
.
The Command-Line Way
In case you can't get your device formatted from the GUI, try this way.
Open the Terminal (Ctrl+Alt+T)
List your block storage devices by issuing the command
lsblk
Then identify your pen drive by it's SIZE. In my case its/dev/sdb
Erase everything in the pen drive (This step is Optional):
sudo dd status=progress if=/dev/zero of=/dev/sdb bs=4k && sync
Replace
/dev/sdb
with your corresponding device.Type very carefully this name or your may end up erasing one of your other disks. This will take some time. (option status=progress is not mandatory but provide you some feedback)
It will pretend to be stuck. Just be patient.
for example:
dd if=/dev/zero of=/dev/sdb bs=4k && sync dd: error writing '/dev/sdb': No space left on device 1984257+0 records in 1984256+0 records out 8127512576 bytes (8.1 GB) copied, 1236.37 s, 6.6 MB/s
Make a new partition table in the device:
sudo fdisk /dev/sdb
Then press letter
o
to create a new empty DOS partition table.Make a new partition:
Press letter
n
to add a new partition. You will be prompted for the size of the partition. Making a primary partition when prompted, if you are not sure.Then press letter
w
to write table to disk and exit.
Format your new partition.
- See your new partition label with the command
lsblk
In my case it is/dev/sdb1
. Once again pay attention to this name as there will not be any protection to prevent you to erase an other disk.
Issue the command below to format the new volume:
sudo mkfs.vfat /dev/sdb1
Please replace
/dev/sdb1
with your corresponding device.Eject the device:
sudo eject /dev/sdb
- See your new partition label with the command