Skip to content

How to format a USB stick with Ubuntu

Rate this post

How to format a USB stick with Ubuntu: Ubuntu it is a very easy to use operating system, especially if we compare it to other Linux distros or to older versions of the same distribution. However, there are some operations that may still be not intuitive enough for those who are beginners with the world of the “penguin”.

One of these is certainly the formatting of USB sticks: that’s why I decided to deal with them in a step-by-step guide in which we will discover together how to format a USB stick with Ubuntu. It is a very easy and quick operation to complete, you just need to know where to get your hands. Read my directions and you will soon realize it.

Just a little clarification before starting: I used to make the tutorial Ubuntu 18.04, but the indications given in the article should be valid for all recent versions of this famous Linux distro. Clear? Perfect, then I would say that we can really put aside the chatter and take action. Find all the information on what to do right below. Happy reading and good luck for everything!

Choosing the file system

USB pendrive

Before seeing how to format a USB stick using Ubuntu, you have to choose the file system to be used on the unit. The file system, if you don’t know, is the one that indicates the way files are managed on a drive (in this case the key) and determines the degree of compatibility of the same with systems and devices. There are basically three file systems that you can use.

  • FAT it is universally recognized by all operating systems and devices (although it has a 4GB per file limit). It is the right choice to create “universal” keys, freely usable on any computer and device,
  • NTFS – it is mainly used on Windows PCs, it is supported by many systems / devices for reading but often not for writing, therefore it should be chosen only if the key is to be used mainly on Windows PC (it has no limits for the size of the individual files hosted on the unit ).
  • EXT4 – it is the Linux file system and is not “digested” very well by Windows, macOS and various devices. I recommend it only if you have to use your key mainly on “penguin” systems.

Format USB sticks with Ubuntu

As already mentioned in the introduction of the tutorial, format a USB stick with Ubuntu it is an operation that can be “difficult” for beginners in the Linux world, but in reality it is really a no-brainer, also because there are at least three ways to proceed: one faster and two others a little more complex and long, to be implemented in case of problems with the former. Now I’ll explain everything in detail.

Standard procedure

How to format a USB stick with Ubuntu

The easiest way to format a USB stick with Ubuntu is to open the file manager of the distro (the icon of the chest of drawers located in the sidebar of the desktop), select the name of the by right clicking USB pendrive present in the side bar of the file manager and select the item Format from the context menu.

In the window that opens, type the name you want to assign to the stick in the field Name of the volume; select the file system you want to use to format it, by placing a check mark next to one of the options available in the section Guy (Internal disk for exclusive use with Linux systems (Ext4), disk for use with Windows (NTFS) or disk for use with all systems and devices (FAT)); choose whether to delete the data currently present on the unit securely (thus making it unrecoverable also through the use of software for data recovery) by moving up ON the lever Clear and click on the button first Following (top right) and then on that Format (always at the top right) to start the operation.

Advanced procedure

If the standard procedure for formatting USB flash drives in Ubuntu has not given the desired results or, even, you cannot view your flash drive through the file manager, you must resort to an alternative procedure, which requires the use of Discs, a utility integrated in Ubuntu that serves, precisely, to manage disks and partitions.

The first step you need to take to format your key in an “advanced” way is, therefore, click on the icon with the 6 white dots located at the bottom of the desktop sidebar, look for the utility Discs in the screen that appears on the desktop and click on the icon of the application in question, to start it.

Ubuntu search

In the window that opens, select the icon of the USB pendrive to format from the left sidebar, click the sul button located at the top right and select the item Format disk from the menu that appears.

How to format a USB stick with Ubuntu

At this point, select the option Compatible with all systems and devices (MBR / DOS) from the drop down menu Partitioning and click on the button Format twice in a row to start the operation.

If you intend to use your key only on recent computers and / or you have a disk of over 2TB of capacity, you can also choose the option Compatible with modern systems and discs (> 2TB) (GPT), which formats the key using a standard for defining the disk partition table called GUID Partition Table, optimized precisely for the most recent systems.

If you want to make the data previously present on the key unrecoverable (also using software for the data recovery), expand the drop-down menu Clear and select the option Overwrite existing data with zeros from the latter. By doing so, you will slow down the formatting procedure of the unit, but you will make the data currently present inside it irrecoverable.

How to format a USB stick with Ubuntu

Now you should have obtained a stick with unallocated space, therefore an empty space not yet partitioned, therefore not yet usable to store data. To complete the work, then select the orange box relating to unallocated space of the stick, click on the button [+] located at the bottom left and, in the screen that opens, indicates the partition size to create (presumably all available space on the drive, if you don’t intend to create more than one partition).

Then click on the button Following (top right) and, in the window that opens, select the file system you want to use to format your USB stick by placing a check mark next to one of the options available in the section Guy: you can choose between Internal disk for exclusive use with Linux systems (Ext4), disk for use with Windows (NTFS) or disk for use with all systems and devices (FAT).

How to format a USB stick with Ubuntu

Finally, type the name you want to assign to the drive in the field Name of the volume and click on the button Create (top right) to complete the operation. Easier than that?

Format a USB stick with Ubuntu from Terminal

How to format a USB stick with Ubuntu from Terminal

If you are delving into the operation of Ubuntu at 360 degrees and, therefore, you are also trying to understand how its works Terminal, you’ll be pleased to find that you can also format the keys from the command line. The procedure to be followed, as easily understood, is a bit more complex and longer than those via the graphical interface that we have seen previously, but it is still quite accessible. Now I’ll talk about it in more detail.

To format a USB stick via the Ubuntu Terminal, you must first start the latter by looking for it in the system menu (the one accessible by clicking on the icon with 6 white dots located at the bottom left of the desktop). After that, give the command lsblk to view the list of disks connected to the computer (including internal disks).

You should be able to locate the key by indicating its capacity in the column SIZE. Be careful to write the name of the right disk: you could risk deleting other units connected to the computer or even the internal hard disk of the PC! In my example, the stick has the name sdb.

Ubuntu terminal

Now, if you want to securely delete all the data on the unit, give the following command: sudo dd status = progress if = / dev / zero of = / dev / sdb bs = 4k && sync (where a sdb you need to replace the name of your stick). For the correct execution of the procedure, you will have to type the Ubuntu administration password.

Once the key is cleared, give the command sudo fdisk / dev / sdb to call the disk management utility from Terminal. Then give the command or to create a new DOS partition table (if you want to create a key that can be used on all systems and devices) or the command g to create a new GPT partition table (if you want to create a key that can only be used on modern systems).

Once you have passed this step, give the command n to create a new partition and then the command p, indicating that you want to get a primary partition. Then give the command 1 to choose the number of the partition to be created, type the number that is suggested to you as the default value (e.g. 2048) to indicate the first sector and do the same for the number of the last sector (e.g. 2013183).

Ubuntu terminal

To conclude this phase, answer Y to the confirmation request. Next, give it the command w to save the changes and the command again lsblk to find out the label that has been assigned to the main partition of the stick: in my example it is sdb1 and is indicated in the column NAME, under the name of the unit (sdb).

Now you can move on to the actual formatting of the drive by giving commands sudo umount / dev / sdb1 (to dismantle the volume) e sudo mkfs.vfat -n NAME / dev / sdb1 (for actual formatting). TO sdb1 you have to replace, in any case, the name of the partition of the stick. TO FIRST NAMEinstead, you must replace the name you wish to assign to the stick (to be written in capital letters).

Ubuntu terminal

You will get a key formatted in FAT. To choose another file system, use the commands sudo mkfs.ext4 / dev / sdb1 (to format the unit in EXT4) or sudo mkfs.ntfs / dev / sdb1 (to format it in NTFS).