Linuxcramfs File System

Source: Internet
Author: User
Article Title: Linuxcramfs 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.

  1. Features of cramfs

In an embedded environment, both memory and external storage resources need to be saved. If you use the RAMDISK method to use the file system, after the system runs, you must first extract the image files from the external storage (Flash) to the memory to construct the RAMDISK environment, to start running the program. But it also has critical weaknesses. Under normal circumstances, the same Code not only occupies space in external storage (in the form of compression ), it also occupies more space in the memory (which exists in the form of decompression), which violates the requirement of saving resources as much as possible in the embedded environment.

Using cramfs is a way to solve this problem. Cramfs is a compressed file system that does not need to decompress all the content in the file system to the memory at a time, but only when the system needs to access data at a certain location, calculate the location of the data in cramfs, decompress the data to the memory in real time, and obtain the data to be read in the file system through access to the memory. The data storage location in the cramfs after decompression and decompression is maintained by the cramfs file system. users do not need to know the specific implementation process. Therefore, this method enhances transparency, it is convenient for developers and saves storage space.

Cramfs has the following features:

Real-time decompression is adopted, but there is a delay in decompression.

Cramfs data is processed and packaged, so it is difficult to write data first. Therefore, cramfs does not support write operations. This feature is suitable for embedded applications that use Flash storage file systems.

In cramfs, the file size cannot exceed 16 MB.

The Group ID is supported, but mkcramfs only saves the low 8 bits of the gid. Therefore, only these 8 bits are valid.

Supports hard links. However, cramfs has not been fully processed. In the file attributes of hard links, the number of links is still 1.

There are no "." Or "." items in the cramfs directory. Therefore, the number of directories in cramfs is usually only one.

In cramfs, the file's timestamps information is not saved. Of course, because inode is stored in the memory, the time of the file in use can be changed to the latest time temporarily, but it will not be saved to the cramfs file system.

The current version of cramfs only supports the PAGE_CACHE_SIZE 4096 kernel. Therefore, if you find that cramfs cannot be normally read/written, you can check the kernel parameter settings.

  2. Use cramfs

Download cramfs-1.1.tar.gzfrom http://sourceforge.net/projects/cramfs. Then execute

Tar zxvf cramfs-1.1.tar.gz

Enter the unpackage to generate the cramfs-1.1 directory and execute the compile command:

Make

After compilation, two tools, mkcramfs and cramfsck, are generated. The mkcramfs tool is used to create the cramfs file system, and the cramfsck tool is used to release and check the cramfs file system.

Command Format of mkcramfs:

Mkcramfs [-h] [-e edition] [-I file] [-n name] dirname outfile

The parameters of mkcramfs are described as follows:

-H: displays help information.

-E edition: Set the version number in the generated file system.

-I file: Insert a file image into this file system (only available in kernel Versions later than Linux2.4.0)

-N name: Specifies the name of the cramfs file system.

Dirname: Specifies the entire directory tree to be compressed

Outfile: the final output file.

Command Format of cramfsck:

Cramfsck [-hv] [-x dir] file

Cramfsck parameters are described as follows:

-H: displays help information.

-X dir: Release the file to the directory specified by dir.

-V: More detailed output information

File: target file to be tested

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.