Can linux recognize fat32

11-17-2023

Designed for programming, automatic code writing robot, free to open. Most people don't quite understand whether this linux can recognize the fat32 article, so Xiaobian summed up the following contents, with detailed contents and clear steps, which has certain reference value. I hope everyone can gain something after reading this article. Let's take a look at whether this linux can recognize the fat32 article.

Linux system can recognize fat32 format by default; Some versions of Red Hat linux also provide limited support for FAT32, and most Linux distribution kernels support FAT32 file system. FAT32 means that the file allocation table is a disk file management method with 32-bit binary number record management.

Operating environment of this tutorial: linux7.3 system and Dell G3 computer.

Can linux recognize fat32? linux system can recognize fat32u disk by default, but can't recognize ntfs format U disk.

Most linux distribution kernels support the FAT32 file system.

Some versions of Red Hat Linux also provide limited support for FAT32, but note that if Linux is installed in FAT32 partition, it must be booted by floppy disk.

If you want to mount a disk partition in FAT32 format, just use the mount command to load it.

What is fat32?

FAT is the abbreviation of File Allocation table, and FAT32 refers to the disk file management mode which adopts 32-bit binary number record management.

Because the core of the FAT file system is the file allocation table, the name comes from this. FAT32 is developed from FAT and FAT16. Its advantages are good stability and compatibility, full compatibility with Win 9X and previous versions, and convenient maintenance. Disadvantages are poor security, and can only support 32GB partition at most, and a single file can only support 4GB at most.

Disk structure

When using FAT32 file system to manage hard disk, the maximum capacity of each partition can reach 128TB. [6] For each logical disk using FAT32 file system, the internal space can be divided into three parts, which are BOOT area (boot area), file allocation table area (FAT area) and DATA area (data area) in turn. Boot area and file allocation table area are also called system area, which occupy a small space at the front end of the whole logical disk and store relevant management information. The data area is the area where the logical disk is used to store the contents of the file, and the area is used as a cluster allocation unit.

Guide area

The first sector of the FAT32 file system is the boot sector, which contains many specific information of a file system, such as the number of FAT tables, the size of each FAT table (number of sectors), the number of bytes in each sector, the number of sectors contained in each cluster, the number of reserved sectors, the size of the file system (number of sectors), the initial cluster number of the root directory and some other additional information. The BOOT area (boot area) uses three sectors from the first sector (logical sector number 0), and saves important parameters and boot records such as the number of bytes per sector of the logical disk and the number of sectors corresponding to each cluster. After that, there are still some reserved sectors, among which there are one to three sectors for backup.

File allocation table area

The file allocation table area (FAT area) is the most important area for the FAT file system to manage disk space and files. It stores the usage information of each cluster in the logical disk data area, which is represented by the bitmap method. The management of storage space and free space occupied by files is realized by FAT. Two identical file allocation tables are saved in the FAT area, so that when the first one is damaged, the second one can be used. The size of the FAT table is determined by the number of clusters in the data area of the logical disk, taking an integer number of sectors. The usage of each cluster in the data area can be known by looking up its filling value in the corresponding position in the FAT table. Each cluster in FAT32 table is represented by four bytes (32 bits), and the first eight bytes (0H-07H bytes) are used to store the media type number of the disc, so the effective cluster number is used from 02H. The usage of 02H cluster is indicated by a 32-bit binary number consisting of 08H-0BH bytes, and the usage of 03H cluster is indicated by a 32-bit binary number consisting of 0CH-0FH bytes, and so on. The corresponding positions of unallocated and recycled clusters are written with zeros, the corresponding positions of bad clusters are filled with specific values of 0fff7h, and the corresponding positions of allocated clusters are filled with non-zero values, specifically, if the cluster is the last cluster of the file, the value is 0FFFFFF7H, and if it is not the last cluster of the file, the value is the cluster number of the next cluster occupied by the file, so that the clusters occupied by the file are just formed into a cluster chain and stored in FAT32.

data field

The data area is used to store user data. It is located after FAT2 and is also divided into clusters. It is numbered from 2, that is, the starting position of cluster 2 is the real starting position of the data area.

(1) root directory

Normally, the root directory is located in cluster 2, but in principle, the root directory in the FAT32 file system can be located anywhere in the data area. The root directory area stores directory entries of files under the root directory, and each directory entry occupies 32 bytes. In FAT32 file system, the ROOT directory is a part of the data area, which is managed in a similar way to the subdirectories, which is obviously different from FAT12 and FAT16. For example, the root directory area of FAT16 file system is a fixed area with a fixed size, occupying 32 sectors immediately after the FAT area, and storing at most 512 directory entries (the reason why the number of files stored in the root directory is limited) as a part of the system area.

(2) subdirectories

In the FAT32 file system, all subdirectories except the root directory are established according to specific needs in the process of being used. If a new subdirectory is created under the root directory, it is called a subdirectory of the root directory, and the root directory is called the parent directory of the subdirectory. When a subdirectory is newly created, a directory entry is established in the cluster allocated to its parent directory, and the initial cluster number of the directory is described in the directory entry, and a cluster is allocated to it in the free space and cleared, and the cluster number of the cluster is recorded in its directory entry. While creating directory entries for subdirectories, the first two directory entries are used in the cluster allocated for subdirectories to record their relationship with the corresponding parent directory.

(3) Directory items

Due to different structures, FAT32 file system generally divides directory entries into four categories: volume label directory entries,. directory entries and ... directory entries, short file name directory entries and long file name directory entries. The short file name directory entry stores basic information such as the short file name, attributes, initial cluster number, time value, content size and so on of subdirectories or files.

Extended knowledge

If you want to mount a disk partition in FAT32 format, just use the mount command to load it.

1. Check the partition and USB device information with fdisk command.

[root@wgods ~]# fdisk -l

2. From the above information, it can be seen that the USB device is in FAT32 format and marked as /dev/sdb1.

[root@wgods ~]# fdisk -l | grep FAT32 /dev/sdb1 * 56 640 3580928 c W95 FAT32 (LBA)

3. Create a usb directory under mnt directory first.

[root@wgods ~]# cd /mnt/ [root@wgods mnt]# mkdir usb

4. Mount the USB flash drive

[root@wgods mnt]# mount -t vfat /dev/sdb1 /mnt/usb

After the mount is successful, you can see the related contents under /mount/usb.

The above is the content of this article about whether linux can recognize fat32. I believe everyone has a certain understanding. I hope that the content shared by Xiaobian will be helpful to everyone. If you want to know more about the relevant knowledge, please pay attention to the Yisu Cloud Industry Information Channel.

Ask AI for details

Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us