Convert fat16 to fat32 linux

Convert fat16 to fat32 linux

This article or section needs expansion.

File Allocation Table (FAT) is a computer file system architecture and a family of industry-standard file systems utilizing it. The FAT file system is a legacy file system which is simple and robust. It offers good performance even in light-weight implementations, but cannot deliver the same performance, reliability and scalability as some modern file systems. It is, however, supported for compatibility reasons by nearly all currently developed operating systems for personal computers and many mobile devices and embedded systems, and thus is a well-suited format for data exchange between computers and devices of almost any type and age from 1981 up to the present.


File system creation

To create a FAT filesystem, install dosfstools .

mkfs.fat supports creating FAT12, FAT16 and FAT32, see Wikipedia:File Allocation Table#Types for an explanation on their differences. mkfs.fat will select the FAT type based on the partition size, to explicitly create a certain type of FAT filesystem use the -F option. See mkfs.fat(8) for more information.

Format a partition to FAT32:

Kernel configuration

Here is an example of the default mount configuration in the kernel:

A short description of the options:

  • All filenames to lower letters on a FAT partitions if enabled: CONFIG_NCPFS_SMALLDOS
  • Enables support of the FAT file systems: CONFIG_FAT_FS , CONFIG_MSDOS_FS , CONFIG_VFAT_FS
  • Enables support of a FAT partitioned harddisks on 86x PCs: CONFIG_MSDOS_PARTITION

If the partition type detected by mount is VFAT then it will run the /usr/bin/mount.vfat script.

Writing to FAT32 as normal user

To write on a FAT32 partition, you must make a few changes to the fstab file.

The user option means that any user (even non-root) can mount and unmount the partition /dev/sdxY . rw gives read-write access.

For example, if your FAT32 partition is on /dev/sda9 , and you wish to mount it to /mnt/fat32 , then you would use:

Now, any user can mount it with:

And unmount it with:

Note that FAT does not support Linux file permissions. Each file will also appear to be executable. You may want to use the showexec option to only mark Windows executables (com, exe, bat) as executable. See mount(8) for more options.

Detecting FAT type

If you need to know which type of FAT file system a partition uses, use the file command:

Alternatively you can use minfo from the mtools package:


how to format an usb drive in fat16/fat32/ntfs from linux command line

One of the reasons of having to use an usb drive is to transfer files between different machines, usually with different operating systems. Unfortunately, there are still enough Windows machines out in the wild that reads only specific file systems in formats such as FAT32 or NTFS.

Читайте также:  Pantum m6502w картридж заправка

This means you will need to format your USB drives in formats that is understood by MS Windows. These may be either FAT16, FAT32 or NTFS file system formats. We will see how you can format an usb drive in any file system format from the Linux command line.

The command that is used to create a new file system is called mkfs in Linux. You can use this to create file systems on any disk, drive or partitions on the system. This utility supports many different file systems, including the FAT ones.

Install dosfstools Package

The support for the FAT file systems are provided by the dosfstools package. Most Linux distros should have this installed by default. If it is not installed, then you will need to install this first using your package manager installation process (apt-get, pacman, emerge etc).

The mkfs utility is only a front-end to the underlying file system builders, which means you can only use those utilities directly as well. The mkfs utility takes a command line option –type (or -t) to specify the file system type to be used.

In order for the system to format the drive, the system should be able to identify the device correctly. You also will need to know the device name for the USB drive. We will assume that the usb is loaded at /dev/sdc for the examples below.

Note: You can use the fdisk command to find the device. Use the fdisk -l command, which will print out all the devices identified by the machine.

In order to create a FAT16 file system on the device, you use one of the following commands.

bash# mkfs -t fat /dev/sdc1

bash# mkfs.fat -F 16 -I /dev/sdc1

There are several different commands, which are all symlinks to mkfs.fat command or utility. There are several different (legacy) names to the tools, which are all available by symlinks. You can use mkdosfs, mkfs.msdos, mkfs.dos, mkfs.fat or mkfs.vfat all of which does the same thing.

If you want to set the block size to 32 then you specify 32 as the value to the -F command line option.

bash# mkfs.fat -F 32 -I /dev/sdc

If you want to use the NTFS for formatting instead of the FAT32, then you can specify that using the same command line options as above….but using NTFS instead.

bash# mkfs.ntfs /dev/sdc1

bash# mkfs -t ntfs /dev/sdc1

All of these commands do support additional options, that will allow you to set or specify several other formatting values. You can specify sector size, volume labels, compression, indexing etc etc. These advanced options vary between the FAT and NTFS formats. You can check manual page of these utilities to find the additional options that they support.



mkfs.fat is used to create a FAT filesystem on a device or in an image file. DEVICE is the special file corresponding to the device (e.g. /dev/sdXX) or the image file (which does not need to exist when the option -C is given). BLOCK-COUNT is the number of blocks on the device and size of one block is always 1024 bytes, independently of the sector size or the cluster size. Therefore BLOCK-COUNT specifies size of filesystem in KiB unit and not in the number of sectors (like for all other mkfs.fat options). If omitted, mkfs.fat automatically chooses a filesystem size to fill the available space.

Читайте также:  Картридж mlt d305l для samsung ml 3750nd

Two different variants of the FAT filesystem are supported. Standard is the FAT12, FAT16 and FAT32 filesystems as defined by Microsoft and widely used on hard disks and removable media like USB sticks and SD cards. The other is the legacy Atari variant used on Atari ST.

In Atari mode, if not directed otherwise by the user, mkfs.fat will always use 2 sectors per cluster, since GEMDOS doesn’t like other values very much. It will also obey the maximum number of sectors GEMDOS can handle. Larger filesystems are managed by raising the logical sector size. An Atari-compatible serial number for the filesystem is generated, and a 12 bit FAT is used only for filesystems that have one of the usual floppy sizes (720k, 1.2M, 1.44M, 2.88M), a 16 bit FAT otherwise. This can be overridden with the -F option. Some PC-specific boot sector fields aren’t written, and a boot message (option -m) is ignored.


mkfs.fat can not create boot-able filesystems. This isn’t as easy as you might think at first glance for various reasons and has been discussed a lot already. mkfs.fat simply will not support it 😉



The home for the dosfstools project is its GitHub project page.


FAT (Русский)

Таблица размещения файлов (FAT) — это классическая архитектура файловой системы компьютера и семейство стандартных файловых систем, использующих ее. Файловая система FAT представляет собой устаревшую файловую систему, которая проста и надежна. Она обеспечивает хорошую производительность даже в облегченных реализациях, но не может обеспечить такую же производительность, надежность и масштабируемость, как некоторые современные файловые системы. Тем не менее, она поддерживается по соображениям совместимости почти всеми разрабатываемыми в настоящее время операционными системами для персональных компьютеров и многих мобильных устройств и встроенных систем и, таким образом, является хорошо подходящим форматом для обмена данными между компьютерами и устройствами практически любого типа и возраста с 1981 года до настоящего времени.


Создание файловой системы

mkfs.fat поддерживает создание FAT12, FAT16 и FAT32. По умолчанию используемый тип файловой системы выбирается автоматически по размеру раздела, но вы также можете явно прописать нужный тип с помощью опции -F . Подробнее смотрите mkfs.fat(8) .

Форматирование раздела в FAT32:

Конфигурация ядра

Ниже приведен пример конфигурации монтирования по умолчанию в ядре:

Краткое описание этих параметров:

  • Все имена файлов в нижнем регистре букв на разделах FAT, если они включены: CONFIG_NCPFS_SMALLDOS
  • Включает поддержку файловых систем FAT: CONFIG_FAT_FS , CONFIG_MSDOS_FS , CONFIG_VFAT_FS
  • Включает поддержку разметки жестких дисков FAT на компьютерах 86x: CONFIG_MSDOS_PARTITION

Если тип раздела, обнаруженный монтированием, является VFAT, тогда запускается скрипт /usr/bin/mount.vfat .

Запись на FAT32 в качестве обычного пользователя

Чтобы записать на раздел FAT32, вы должны внести несколько изменений в файл fstab.

Флаг user означает, что любой пользователь (даже не root) может монтировать и размонтировать раздел /dev/sdxY . Флаг rw дает доступ на чтение и запись.

Например, если ваш раздел FAT32 находится на /dev/sda9 , и вы хотите смонтировать его на /mnt/fat32 , вы должны использовать:

Теперь любой пользователь может смонтировать его с помощью:

И размонтировать его с помощью:

Имейте в виду, что FAT не поддерживает права доступа Linux. С параметрами монтирования по умолчанию все файлы будут считаться исполняемыми. Вы можете использовать опцию showexec вместо параметров umask и dmask, которые отметит исполняемыми только файлы Windows (com, exe, bat). Смотрите также mount(8) .

Читайте также:  Драйвера amd на linux manjaro

Определение типа FAT

Если вы хотите узнать, какой конкретно тип FAT используется на определённом разделе, используйте команду file:

Также можно использовать команду minfo из пакета mtools :


Format a USB drive as FAT32 in Linux

This can be useful if you need to flash some BIOS or interact with a Windows machine file system.

Why FAT32

Although in theory no one should be using these file systems anymore, in practice, sometimes you just need one, for example for flashing your motherboard’s BIOS or some other arcane task. Or maybe just for having a drive that’s compatible with Windows.

Whatever the reason, here is a guide on how to achieve this using Linux.

First, correctly identify the drive location

Open a terminal and type:

You’ll see a list of storage devices connected to your computer and their partitions —if any.

You need to identify the one you just connected. It’s very easy if your devices are of different sizes, since that accurately pinpoint the drive you want to work with.

PLEASE MAKE SURE you identify the drive correctly, as the following procedure will wipe EVERYTHING on it with NO RECOVERY chance.
You’ve been warned!

I’ll be using a 1GB drive for this guide.
The data for this device using sudo fdisk -l looks like this:

So, my drive is /dev/sdb . Yours could be /dev/sdc or something else.

Pay careful attention.

Optional: Write zeros to the drive

This is optional.

But, for security reasons, and to verify that there are no outstanding problems with the drive, I recommend to do it every once in a while.

We’ll use the venerable dd command for that:

When finished, you’ll see something like this:

The write speed varies a lot depending on the type of drive you have.

Create the DOS partition table

Let’s open the disk with fdisk .

You’ll see something along these lines:

As you can see, it automatically created a new empty DOS partition table for us.

If you want to see the available options enter m for help:

Pressing o would give us the same result —a new empty DOS partition table.

Now, let’s write this brand new partition table to the /dev/sdb disk by pressing w :

After the operation takes place, it’ll exit automatically.
Let’s re-open the drive, and enter the following sequence of commands:

  1. n => New partition —accept all defaults for partition type, partition number, first sector and last sector, so it takes all the space available on the device
  2. t => Changes a partition type
  3. b => Picks W95 FAT32
  4. p => Shows partition info
  5. w => Writes changes and exit

This is the output from the commands above:

Now, if you look at your drive info with sudo fdisk -l you’ll see something like this:

Create a new FAT32 file system

Now, let’s create a FAT32 file system on it so we can use the drive and copy files to it.

That’s it, your drive should be already accessible from your file explorer and be ready to copy that pesky BIOS flash file to it! 🎉


Поделиться с друзьями