How to format a pendrive through the Linux terminal

Linux Bootable USB Pendrive

Although it is becoming easier to have a light graphical environment that hardly consumes resources and that is useful to operate remotely or on computers with few resources. Even so, it is always advisable to know the handling of the terminal and how to do certain operations through this important Gnu / Linux tool.

The steps as well as the process are compatible with any Gnu / Linux distribution, we can even use it in the Ubuntu terminal that works in Windows 10, information that will be useful for the most novice users.

The address of the pendrive is one of the most important points when formatting a pendrive

First of all, we have to know and know the direction that the Gnu / Linux system has given to the pendrive. For that, we just have to write the df command in the terminal and it will tell us which units are connected in the system. A trick: normally the Gnu / Linux system always assigns the letters "sdaX", so if we only have one pendrive connected, it will be a similar or equal name.

Once we have located the pendrive, we have to disassemble it from the system so that it can be formatted. In this case we have to write the following in the terminal:

sudo umount  /dev/sda1

Now that the pendrive is disassembled, we have to write the following in the terminal:

sudo mkfs.vfat -F 32 -n "Nombre_pendrive" /dev/sda1(dirección del pendrive)

The variable -F 32 tells the system that formatting must be done with the Fat32 file system. If we use the variable -n we have to indicate the name of the unit, a name that will appear every time we connect the pendrive to our computer. This name can be "pen-drive-name" or just any other name.

Once the process is finished, we only have to mount the pendrive and we will see how the disk does not have any data, something that usually happens when we format a drive or pendrive. By last, emphasize that we must know well the address of the pendrive, since if we get confused and put another address, such as the HD address, we can run out of operating system. Keep it in mind.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

7 comments, leave yours

Leave a Comment

Your email address will not be published.



  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Mapimap said

    weird that it is sdaX, it is dangerous, sda is the hard disk, unless it does not have

  2.   Bubexel said

    I think the example is diabolical / dev / sda1 is usually a system partition, better to put / dev / sdX1

  3.   Elche said

    Nope, better before doing a sudo fdisk -l to know which disk is the USB, be careful with / sda which is the hd of the system. Better exfat than fat32, it is also read by Windows and it is faster. Greetings.

    1.    AlexRE said

      Better ext2 or f2fs than exFAT or FAT32 if you are going to work with the pendrive more in GNU / Linux; although IFS also exist to be able to use ext * and f2fs in Windows and probably also in macOS.

  4.   Albert78 said

    mkfs.vfat: unable to open / dev / sdb1: Read-only file system. Greetings that I can do the pendrive does not allow formatting I have tried many ways all from linux. I still don't use windows tools and I don't want to. But this pendrive that cannot be formatted, I can read all the information it has, but it does not allow to delete any, it does not allow to save anything else in it and I cannot format it, I already tried with the chmod permissions, I tried to format it with gparted.

  5.   Asda said

    It is easier to use the memory formatter that comes in XD accessories

  6.   eye hack said

    I delete the windows in the partition I had, it is better to be careful with these codes, luckily it did not have anything important.

bool (true)