Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the Linux MTD device file system

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces to you what is the Linux MTD device file system, the content is very detailed, interested friends can refer to, hope to be helpful to you.

1. Introduction to file system

The file system is a method of storing and organizing computer data, which makes it easy to access and find it. The file system uses the abstract logic concept of files and tree directories to replace the concept of data blocks used by physical devices such as hard disks and optical discs. Users use the file system to save data without paying attention to the data blocks that are actually saved on the hard disk (or CD). You just need to remember the directory and file name of the file. Before writing new data, the user does not have to care that the block address on the hard disk is not used, the storage space management (allocation and release) function on the hard disk is automatically completed by the file system, and the user only needs to remember which file the data is written to.

File systems usually use storage devices such as hard drives and CDs and maintain the physical location of files in the device. However, in fact, the file system may be just an interface to access data, and the actual data is provided through network protocols (such as NFS, SMB, 9p, etc.) or on memory, and there may even be no corresponding files (such as proc file system).

Strictly speaking, the file system is a set of abstract data types (Abstract data type) that realize the storage, hierarchical organization, access and acquisition of data.

two。 Relationship between storage device and file system

In embedded system, the storage devices related to file system include hard disk, Flash memory and so on. Flash memory is divided into Flash chip devices (Raw Flash device, also known as MTD devices) and devices with Flash controllers (Flash Translation Layer device, FTL devices). The key difference between the two is whether there is a Flash controller, which directly determines that the file system is divided into two types.

MTD devices include NOR Flash, NAND Flash, etc., and FTL devices include SD, eMMC, SSD, USB mass storage devices and so on. JFFS2, YAFFS2, UBIF, LogFS support MTD devices, while FAT, EXT3/4, XFS, and Btrfs support FTL devices and hard drives (HDD). The device file corresponding to the MTD device is / dev/mtd,FTL device and the device file corresponding to the dev/mtd,FTL device can be / dev/mtdblock.

3. MTD device file system 3.1.1 JFFS2

JFFS means "Journaling Flash File System". The file system is a log file system based on Flash memory developed by Axis Communications in Sweden. The company released the first version of the JFFS file system on GNU/Linux in 1999, and later released the second version of JFFS2 after the development of Redhat. JFFS2 is a log structure (log-structured) file system that stores file system data and original data on flash memory in the form of nodes. Mainly used for nor flash memory, based on MTD driver layer, characterized by: read-write, support data compression, hash table-based log file system, and provide crash / power-down security protection, provide "write balance" support, and so on. The main disadvantage is that when the file system is full or nearly full, the running speed of JFFS2 is greatly slowed down because of garbage collection.

The disadvantages of JFFS2 include: long mounting time, uneven reading and writing of chip memory blocks, poor scalability and so on. JFFS2 is not suitable for NAND flash memory mainly because the capacity of NAND flash memory is generally large, which leads to a rapid increase in the memory space occupied by JFFS2 to maintain log nodes. in addition, the JFFS2 file system needs to scan the contents of the entire FLASH when mounting to find all log nodes and establish file structure, which will take a lot of time for large-capacity NAND flash memory.

3.1.2 YAFFS2

YAFFS/YAFFS2 is a log file system designed for embedded systems to use NAND flash memory. Compared with JFFS2, it reduces some features (for example, it does not support data compression), so it is faster, has a shorter mount time, and consumes less memory. In addition, it is a cross-platform file system.

YAFFS/YAFFS2 comes with the driver of NAND chip, and provides the embedded system with API to access the file system directly. Users can operate on the file system directly without using MTD and VFS in Linux. Of course, YAFFS can also be used with the MTD driver. This facilitates its cross-platform migration.

The main difference between YAFFS and YAFFS2 is that the former only supports small page (512 Bytes) NAND flash memory, while the latter supports large page (2KB) NAND flash memory. At the same time, YAFFS2 has greatly improved in memory footprint, garbage collection speed, read / write speed and so on.

3.1.3 UBIFS

UBIFS (Unsorted Block Image File System) was first designed by Thomas Gleixner,Artem Bityutskiy, an engineer of IBM and Nokia, in 2006 to solve the bottleneck encountered by MTD (Memory Technology Device) equipment. Due to the rapid growth of NAND Flash capacity, YAFFS and others can no longer control the space of NAND Flash. UBIFS handles the actions with MTD device through the subsystem UBI. Like JFFS2, UBIFS is built on top of MTD device and is therefore incompatible with general block device.

UBIFS is more suitable for NAND Flash than YAFFS2 and JFFS2 in design and performance. For example, UBIFS supports write-back, the data written by UBIFS will be cache, and the data will not be written to Flash until it is necessary to write, which greatly reduces the number of scattered cell blocks and improves the efficiency. The UBIFS file system directory is stored on Flash, and UBIFS mount does not require data from the entire Flash to recreate the file directory. Support on-the-flight to compress file data, and optionally compress some files. In addition, UBIFS uses logs (journal) to reduce the frequency of updates to Flash index.

3.1.4 Summary

At present, the mainstream choice is UBIFS and YAFFS2. If it is a non-Linux system, you can choose YAFFS2 with good portability.

About what is the Linux MTD device file system to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report