Newbie School: Detailed introduction to the embedded Linux file system

Source: Internet
Author: User
Article title: Newbie School: Detailed introduction to the embedded Linux file system. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Linux supports multiple file systems, including ext2, ext3, vfat, ntfs, iso9660, jffs, romfs, and nfs. to centrally manage various file systems, linux introduces Virtual File System (VFS), which provides a unified operation interface and application programming interface for various File systems.

The file system structure in Linux is as follows:

During Linux startup, the first file system must be mounted. if the system cannot mount the root file system from a specified device, the system will exit the startup due to an error. You can then automatically or manually mount other file systems. Therefore, different file systems can exist in a system at the same time.

Different file system types have different characteristics, so there are different application scenarios based on the hardware characteristics and system requirements of storage devices. In embedded Linux applications, the main storage devices are RAM (DRAM, SDRAM) and ROM (FLASH memory is often used). commonly used file system types based on storage devices include: jffs2, yaffs, cramfs, romfs, ramdisk, ramfs/tmpfs, etc.

1. FLASH-based file system

As the main storage medium of embedded systems, Flash memory has its own characteristics. The Flash write operation can only change 1 of the corresponding position to 0, but not 0 to 1 (Flash erased restores the content of the corresponding storage block to 1). therefore, generally, when writing content to Flash, you must first erase the corresponding storage range. This erasure is performed in blocks.

Flash memory mainly includes the NOR and NAND technologies (for a simple comparison, see the appendix ). Flash memory has a limited number of writes. NAND Flash memory also has special hardware interfaces and read/write time series. Therefore, you must design a file system that meets application requirements based on Flash hardware features. traditional file systems such as ext2 have many drawbacks when used as Flash file systems.

In embedded Linux, MTD (Memory Technology Device, storage Technology Device) provides a unified abstract interface between the underlying hardware (flash Memory) and the upper layer (file system, that is, the Flash file system is based on the MTD driver layer (see the file system structure diagram in Linux above ). The main advantage of using the MTD driver is that it is specially designed for a variety of non-volatile memory (mainly flash memory, therefore, it provides better support, management, and sector-based erasure and read/write operations for Flash.

By the way, a Flash chip can be divided into multiple partitions, and different file systems can be used for each partition. the Two Flash chips can also be combined into one partition and used in one file system. That is, the file system is for memory partitions, rather than storage chips.

(1) jffs2

JFFS is a file system first developed by Swedish Axis Communications based on the Linux kernel for embedded systems. JFFS2 is a flash file system developed by RedHat based on JFFS. it was originally an embedded file system developed for the RedHat embedded product eCos. Therefore, JFFS2 can also be used in Linux and uCLinux.

Jffs2: log Flash File System Version 2 (Journalling Flash FileSystem v2)

It is mainly used for NOR-type flash memory and is based on the MTD driver layer. it features read/write, data compression, and hash-table-based log file systems, it also provides crash/power-down security protection and "write balance" support. The main drawback is that when the file system is full or near full, jffs2 is greatly slowed down due to the spam relationship.

Jffs3 is currently under development. For more information about how to use the jffsseries file system, see mtd-jffs-howto.txt in the mtdpatch.

Jffsx is not suitable for NAND flash memory because the capacity of NAND flash memory is generally large, which leads to a rapid increase in the memory space occupied by jffs to maintain log nodes. In addition, when mounting a jffsx file system, you need to scan the entire FLASH content to find all log nodes and create a file structure. it takes a lot of time for large-capacity nand flash memory.

[1] [2] [3] Next page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.