Use of the Linux operating system command mkdosfs

Foreword:

mkdosfscommand is commonly used to create DOS filesystems on Linux systems. By default it will create a FAT12 or FAT16 file system. If you need to create a larger file system, you can use -Fthe parameter to specify the file system type as FAT32.

The following are mkdosfs common options for the command:

  • -n: Specify the volume label name;
  • -F: Specify the file system type;
  • -I: Quickly format the device;
  • -v: Display detailed information during formatting;

Here is an example of using mkdosfsthe command to create a DOS filesystem:

sudo mkdosfs  -F 32 -I /dev/sdc1 -n MY_DISK

This command will format the device as FAT32 file system, volume label "MY_DISK", and perform a quick format. With this command, you can format USB, SD card and other storage devices into DOS file system, and then transfer and share data between Windows and Linux and other systems. /dev/sdc1


Notice:

mkdosfs Once the command is executed, all data on the specified device will be cleared. Therefore, when using this command, be sure to confirm that the specified device and options are correct to avoid irreparable data loss.

Extras:

FAT (File Allocation Table) is a file system widely used in mobile storage devices and operating system partitions. There are three versions of the FAT file system, FAT12, FAT16, and FAT32, with the following differences:

  1. Capacity limitation: The FAT12 file system supports 4085 clusters (each cluster size is 512 bytes), and the maximum capacity is about 2 MB. The FAT16 file system supports a maximum partition capacity of 2GB, a maximum cluster number of 65526, and a cluster size of 512 bytes or 1024 bytes. The FAT32 file system supports a maximum partition capacity of 2TB, a maximum cluster number of 268,435,445, and a cluster size of 4096 bytes.

  2. File system performance: FAT12 is more inefficient than FAT16 and FAT32, because each cluster contains only 512 bytes, and the number of clusters is larger, and the read and write speed is slower. The performance of FAT16 is better compared to FAT12 because FAT16 has less overhead to access the FAT table. FAT32 has larger clusters, which can reduce storage space, but in the process of finding the next free cluster, more items need to be accessed to find the next available cluster, so its performance is poor.

  3. Filename Length: In FAT12 and FAT16, the maximum length of the filename is 8 characters plus 3 characters for the extension, while in FAT32, the maximum length of the filename is 255 characters.

To sum up, the three versions of the FAT file system have their own characteristics and advantages and disadvantages. If you need to use a device with a smaller capacity or need to be compatible with some old-fashioned systems, you can choose to use the FAT12 or FAT16 file system; and if you need to use a large-capacity storage device, you can also choose to use the more advanced FAT32 file system.

Guess you like

Origin blog.csdn.net/FLM19990626/article/details/131220039