In Windows there is a straightforward "Format" option in a flash drive's right-click pop-up menu. Where's that in Ubuntu?
-
Ubuntu 18.04 has a "Format..." option, when you right-click on the USB drive in Files. – Stefan_EOX Jul 25 '19 at 07:25
13 Answers
You can use Disks. It's installed by default and easy to use.
- Click on the Dash icon
- Search for "Disks"
- Click on Disks
The application will show 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:

- 70,465

- 15,171
-
-
In Ubuntu 14.04, The Disks utility may not select the partition by default--click on the big wide rectangle (it may be called Partition 1), and then the format option will be enabled. – Steve Koch Mar 28 '16 at 01:30
-
2FWIW, when starting it from the CLI (e.g. in i3), the name is
gnome-disks
. – Raphael Jul 13 '18 at 06:42 -
I needed this first: https://askubuntu.com/questions/500549/how-to-run-gnome-disk-utility – pateksan May 24 '20 at 12:02
-
Greetings from the future 2020. Hey, this is still valid in 20.04!!! – dance2die Oct 24 '20 at 01:30
Use GParted
You can install it
from Ubuntu Software Center or
on the command-line:
sudo apt install gparted
Use the command line
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
.

- 70,465

- 2,563
-
4It will work even if the usb is write protected. Thanks alot. – Mansoorkhan Cherupuzha Feb 05 '16 at 12:07
-
For pen-drive, you don't need the
-I
option, and might prefer to use:mkfs.fat -v -F 32 -n "MyUsbStick" /dev/sda
. – not2qubit May 30 '18 at 13:07 -
To rename a FAT16 or 32 filesystem I am more used to:
sudo mlabel -i /dev/sdy1 ::name_for_your_pendrive
#(on one line, mind the dobble :) – kFly Sep 23 '18 at 10:51 -
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
-
19if you lost patience while waiting for
dd
you can always
– Donald Derek May 09 '15 at 18:52ps aux | grep dd
copy process id thenwatch -n 4 kill -USR1 pid
-
2As opposed to the GUI way it actually properly formats the stick and allows (using the -n
parameter) to set the label of that disk. The GUI way doesn't work for me. – Matthias Hryniszak Dec 26 '16 at 09:58 -
After erasing with the dd command you can try reconnect and do the partition in the GUI itself. – Krishnadas PC Sep 23 '17 at 04:42
-
This is great. I suggest also doing
sudo apt-get install pmount
- it will take care of thesync
and remounting at the same location automatically. – SDsolar Jan 16 '18 at 22:27 -
Use
status=progress
as another argument to thedd
command in step 3. This will give you feedback, so you'll know how the erasion goes. – quapka Mar 20 '18 at 19:56 -
3Before exiting fdisk (step 5), set the correct partition type by first typing
t
and then choosing hex codeb
for “W95 FAT32”. – igor May 23 '18 at 06:08 -
-
1but instead of type b use type c, or, https://dottheslash.wordpress.com/2011/11/29/deleting-all-partitions-on-a-usb-drive/ – Ferroao Dec 04 '18 at 12:49
-
I corrupted a USB drive and am currently going with the terminal way described above to rewrite the partition table. Though:
dd
really is taking A LOT of time. I let it go for all the night, in recovery mode (so the pc was doing just that) and it was able to do 1.8GB only, at 40kb/s - and only because it began, for some reason, to work at 1.5GB. Is there a way to speed it up? It will need weeks of continous work to do all the 32GB of the stick... – il mietitore Nov 11 '19 at 11:13 -
These steps worked for me except the mkfs step. I got the error
mkfs.vfat: /dev/sdb1 contains a mounted filesystem.
I resolved this error by runningumount /dev/sdb1
before the mkfs command. – Trevor Feb 08 '20 at 00:18 -
Is it a problem if you use a bigger block, say 4M, for the
dd
command? Definitely speeds up things. – fkaralis Jun 03 '20 at 07:00 -
Maybe you could edit your answer to include the comment of @igor and @Ferroao to not use another program but only
fdisk
. – Timo Oct 18 '21 at 19:02
Run the below commands to format the usb to fat32 filesystem from terminal,
sudo su
fdisk -l
(this helps to discover your pendrive /dev/sdxx)
umount /dev/sdxx
then format your device to FAT32
mkdosfs -F 32 -I /dev/sdxx
Where "xx" is from the command fdisk -l
which denotes your usb drive's last letters.

- 78,556
-
Before doing the
mkdosfs
you want to first wipe the partition table by usingsudo dd if=/dev/urandom of=/dev/sdxx count=24
-- Same goes for if you intend to usemkfs
for an EXT file system. – SDsolar Jan 16 '18 at 22:30 -
1What's the difference between
sdb
andsdb1
? I thought I should usesdb
because I'm formatting the whole drive, but it turns outsdb1
works... – Yan King Yin Dec 04 '18 at 09:04
gparted - the only way to go with formatting drives and HDs etc. It's available for download in the Ubuntu Software Center, just search for gparted.

- 32,155

- 1,425
sfdisk
CLI non-interactive method
echo 'start=2048, type=83' | sudo sfdisk /dev/sdX
sudo mkfs.ext4 /dev/sdX1
erases all data, and creates a single partition that takes up all USB with an ext4 filesystem.
Choose X
based on the output of:
sudo lsblk
sudo fdisk -l
For more detailed description of sfdisk
see: https://superuser.com/questions/332252/creating-and-formating-a-partition-using-a-bash-script/1132834#1132834
fdisk
automation
It is also possible to do the same as above with:
printf 'o\nn\np\n1\n\n\nw\n' | sudo fdisk /dev/sdX
but this method is less maintainable than sfdisk
, which was designed for Scripting fdisk
, specially if you want to create more complex partition tables.

- 28,474
Here are some instruction :
- Plug your flash drive into an empty USB port and back up any data on the drive. Open the main menu, move your cursor over "Accessories" and then click on "Terminal." At the terminal prompt, type
sudo apt-get install gparted
and press Enter. - Enter your Ubuntu administrator password when prompted and press Enter. This will download and install GParted, which is an open-source drive partitioning program
- Go to the Ubuntu main menu after the installation is complete, move your cursor over "System," select "Administration" and click "Partition Editor." Enter your administrator password when prompted and click "OK."
- Click on "GParted" in the toolbar. Hover over "Devices" and select your USB flash drive from the list (dev/sdb1, for example). Right-click on the device in the main GParted window and click "Unmount." It may take a few minutes for the device to be unmounted
- Right-click on the device again after it is unmounted and hover over "Format to." Select the desired file system type -- RiserFS, linux-swap, Ext 2, Ext 3, FAT16 or Fat32, for example -- and click "Apply" in the toolbar. Depending on the size of the flash drive, it will take three to four minutes for GParted to complete the process.
- Close GParted after the flash drive is formatted. To mount your USB flash drive, unplug it and then plug it back in. The drive is now ready to store data in the file format you selected.

- 19,277

- 81
Restore a USB drive to a standard storage device
Install and use mkusb (mkusb-dus), which can format alias restore a USB drive to a standard storage device (with an MSDOS partition table and a partition with the FAT32 file system). These instructions are also relevant for other drives (memory cards, hard disk drives, HDD, solid state drives, SSD).
If you run standard Ubuntu, you may need an extra instruction to get the repository Universe. (Kubuntu, Lubuntu ... Xubuntu have the repository Universe activated automatically.)
sudo add-apt-repository universe # only for standard Ubuntu
sudo add-apt-repository ppa:mkusb/ppa # and press Enter
sudo apt-get update
sudo apt-get install mkusb mkusb-nox usb-pack-efi
See these links with more detailed instructions,
mkUSB-quick-start-manual.pdf or if the link does not work, this alternate link
mkusb version 12 alias mkusb-dus:
mkusb wipes the first megabyte as a first step of restoring it
Sometimes some data are 'tricking' the software to think that the pendrive does not work, even when it is good, and it is enough to wipe the first megabyte to get rid of those data. You may 'look at' the drive with a tool, that does not recognize or understand correctly the structure of the boot system, for example if it was cloned from an iso file.
What to do if mkusb fails
There are many ways that a USB pendrive can fail. So it is worth trying different things. If mkusb fails, try according to this list,
- On some pendrives and on many memory cards there is a small mechanical switch for write protection, that can toggle between read/write and read-only. You might have set it read-only without intention.
- Reboot the computer and try again to restore or wipe the first megabyte with mkusb.
- Disconnect other USB devices. Sometimes USB devices can disturb the function for each other.
- Try other USB ports and another computer.
- Try another operating system (Windows, MacOS) in another computer.
- If you still cannot wipe the first megabyte of the drive, and the drive is read-only, it is probably 'gridlocked', and the next stage is that it will be completely 'bricked'.
There is a limit, when you have to accept that the pendrive is damaged beyond repair, at least with tools available to normal users like you and me. See this link

- 46,324
- 5
- 88
- 152
Firstly use fdisk -l
in order to see usb partition, then if:
ext == > mkfs.ext3 /dev/sda1
FAT/FAT32 ==> mkfs.vfat /dev/sda1
Note: You must be root or using sudo to do that.

- 310
- 1
- 6
- 19
if you are running Ubuntu 12.04 LTS then you can easily do this. just plug in your usb and in left panel you will see a USB icon. go over there and right click. there will be a option to format it.

- 21
- 1
Here is a very simple way: In linux system: use fdisk to check which is your usb disk. then use fdisk sdx,usually is sdb, to do some operation on your usb disk.
press o enter press d enter to empty your disk.
then you can plug your usb drive to a windows operation system and do the normal format.

- 757
- 2
- 9
- 27
I use Startup Disk Creator
, installed by default, to format my USB drives.
- Open up 'startup Disk Creator' by searching for it in the dash.
- Insert your flash drive, it will be detected automatically.
- Select it (in case you have more than one)
- Press 'Erase Disk'
See screenshot below:

- 15,325
- 24
- 86
- 117
-
@Parto, as an Arabic speaker, the title bar of the window was extremely hard to read because I kept on interpreting the Arabic letters rather than figuring out what those letters are suppose to look like as English characters.. lol – Fadi Mar 09 '17 at 20:35
-
@Fadi Hahah. It's the 'Pseudo Saudi' - font. http://www.dafont.com/psuedo-saudi.font – Parto Mar 10 '17 at 07:11
-
I faced this problem especially after the installation of Ubuntu, my USB drive just became no longer usable. I could only use around 1 GB of my 16 GB USB drive. When I entered lsblk
command on the command line interface it only showed 1 GB part of the USB available but it did not show the rest 14.5 GB as an unavailable part.
Eventually, I created a partition on my USB by using GParted on Ubuntu. Open GParted and then GParted -> Devices -> /dev/sdb (14.56 GiB) in my case. I selected that and then go to Device -> Create Partition and then click on Apply. After that, I unmounted and mounted back my USB. Then GParted -> Devices -> /dev/sdb on my case, and then Partition -> Format to -> fat32. I clicked on that and then click on the green tick symbol and then it will format.
The similar command of that format in command line interface is I think mkfs.fat -F 32 -v -l -n
. That was my case.