Home Command line utilities Format USB drives In FAT32 Or NTFS Format In Arch Linux

Format USB drives In FAT32 Or NTFS Format In Arch Linux

By sk
Published: Last Updated on 66.9K views

Today, we will see how to format USB drives in FAT or NTFS file system in Arch Linux and its derivatives like Antergos and Manjaro Linux. There are many GUI tools available to get this job done. However, some of you might wondering if there is any way to format the usb drives from command line. No worries! This tutorial will teach you how. The following are the two commands that I use throughout this guide to format the USB drives in FAT or NTFS format.

  1. mkfs.vfat
  2. mkfs.ntfs

As the name implies, mkfs.vfat will format an USB drive in FAT, and mkfs.ntfs will format the USB drive in NTFS format.

These two utilities comes preinstalled with most Linux distributions. However, these two aren't available in my Arch Linux minimal system. After a few google search, I came to know that I must install the following two packages in-order to use those commands.

  1. dosfstools
  2. ntfsprogs

They are available in the default repositories of Arch Linux. So, you can install them by running the following command using Pacman as shown below.

$ sudo pacman -S dosfstools

To install ntfsprogs, run:

$ sudo pacman -S ntfsprogs

Now, let us see how to format an USB drive in MSDOS file system. The commands are same for almost all Linux distributions.

Format USB drives In FAT32 Or NTFS Format In Arch Linux

First, we will see how to format the usb drive in FAT.

Format USB drive in FAT32

First we will find out the USB drive name (This is what we say Drive letter in Windows OS).

It's very simple, but at the same time you should be very careful if you are using dual-booting with Windows. If you don't be careful, you might format one of your windows partitions accidentally.

We can easily find out our disk drive letters using fdisk command.

Plug your USB drive and run the following command to display the partition table.

$ sudo fdisk -l

Sample output:

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
 Units: sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disklabel type: dos
 Disk identifier: 0x4c986a38

Device Boot Start End Sectors Size Id Type
 /dev/sda1 2048 206847 204800 100M 83 Linux
 /dev/sda2 4401152 976773167 972372016 463.7G 83 Linux
 /dev/sda3 206848 4401151 4194304 2G 82 Linux swap / Solaris

Partition table entries are not in disk order.
 Disk /dev/sdb: 7.5 GiB, 8053063680 bytes, 15728640 sectors
 Units: sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disklabel type: dos
 Disk identifier: 0xfdc01076

Device Boot Start End Sectors Size Id Type
 /dev/sdb1 * 63 15728639 15728577 7.5G c W95 FAT32 (LBA)

As you see in the above output, I have two disks. One is my local hard disk (500 GB), and another one is my USB drive (8 GB).

Again, I warn you please be careful if you are using dual boot with Windows or if you have multiple OSs in the single hard drive. If you use dual boot, this command will also display the Windows drives names like /dev/sdb1, /dev/sdc1 etc., in the above result. Just make sure you are formatting the correct drive.

As I mentioned in the above screenshot, my USB drive name is /dev/sdb1.

Once you find out the USB drive name, unmount it. Because you can't format a mounted drive. Do not un-plug, just unmount the USB drive.

To unmount the drive, run:

$ sudo umount /dev/sdb1

Sample output:

Finally, format the USB drive in FAT32 using command:

$ sudo mkfs.vfat /dev/sdb1

Sample output:

mkfs.fat 4.0 (2016-05-06)

After formatting the drive, just unmount using it command:

$ sudo umount /dev/sdb1

Again, re-plug the USB drive to start using the it.

For further details, refer man pages.

$ man mkfs.vfat

Format USB drive in NTFS

Similarly, To format the drive in NTFS, just run:

$ sudo mkfs.ntfs /dev/sdb1

For more options, refer man pages.

$ man mkfs.ntfs

Set label name to USB drives

To set drive label name use '-n' flag.

For example, the following command will format my USB drive in FAT32 format and set label name for my USB drive as "sk".

$ sudo mkfs.vfat /dev/sdb1 -n sk

Please note that lowercase labels might not work properly with DOS or Windows. So, use upper case label name.

And, that's all for now. You know now how to format an USB drive in MSDOS filesystem in Arch Linux. Hope this helps. If you find this guide helpful, please share it on your social, prpfessional networks and support OSTechNix.

More good stuffs to come. Stay tuned!

Cheers!

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More