How to use TMPFS under Linux

Source: Internet
Author: User
Tags file system linux

TMPFS Introduction

TMPFS is a virtual memory file system, not a block device. is a memory-based file system that does not need to be initialized with MKFS, etc. when created

Its biggest feature is its storage space in the VM (virtual memory), the VM is managed by the VM subsystem inside the Linux kernel.

The size of the VM below Linux is made up of RM (real Memory) and swap, and the size of the RM is the size of the physical memory, and the size of the swap is determined by itself.

Swap is a virtual memory space through the hard disk, as a result, its read and write speeds are much slower than RM (real Memory), and when a process requests a certain amount of memory, as the kernel's VM subsystem discovers that there is not enough RM, some of the infrequently used data in RM is swapped into swap. If you need to reuse the data, swap them from swap to RM. If you have large enough physical memory, you can partition the swap without dividing it.

More about swap: http://blog.csdn.net/haibusuanyun/article/details/16336593 Click on the Open link

The VM consists of two parts of Rm+swap, so the maximum storage space for TMPFS is up to (the size of RM + the size of Swap). But for TMPFS itself, it doesn't know whether the space it uses is RM or swap, which is managed by the kernel's VM subsystem.

Tmpfs default size is half of RM, if your physical memory is 1024M, then tmpfs default size is 512M

Typically, it is configured to be smaller than the physical memory size.

The size of the TMPFS configuration does not really occupy this block of memory, if the/dev/shm/without any files, it occupies the memory is actually 0 bytes, if it is the largest 1G, there are 100M files, the remaining 900M can still be used for other applications, However, the 100M of memory it occupies will not be reclassified by system recycling.

When you delete a file in Tmpfs, the Tmpfs file system driver dynamically reduces the file system and frees the VM resources.

#########################

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.