Linux ramfs,rootfs,tmpfs,ramdisk,initrd and initramfs

简介

1、ramfs

Ramfs is a very simple filesystem that exports Linux's disk caching mechanisms (the page cache and dentry cache) as a dynamically resizable RAM-based filesystem. 

2、rootfs

Rootfs is a special instance of ramfs (or tmpfs, if that's enabled), which is always present in 2.6 systems.  You can't unmount rootfs for approximately the same reason you can't kill the init process; rather than having special code to check for and handle an empty list, it's smaller and simpler for the kernel to just make sure certain lists can't become empty.

3、tmpfs

tmpfs is a file system which keeps all files in virtual memory.

4、ramdisk

The RAM disk driver is a way to use main system memory as a block device.  It is required for initrd, an initial filesystem used if you need to load modules in order to access the root filesystem (see Documentation/initrd.txt).  It can also be used for a temporary filesystem for crypto work, since the contents are erased on reboot.

5、initrd

 
  
initrd provides the capability to load a RAM disk by the boot loader.This RAM disk can then be mounted as the root file system and programs can be run from it. Afterwards, a new root file system can be mounted from a different device. The previous root (from initrd) is then moved to a directory and can be subsequently unmounted.

6、initramfs

All 2.6 Linux kernels contain a gzipped "cpio" format archive, which is extracted into rootfs when the kernel boots up.  After extracting, the kernel checks to see if rootfs contains a file "init", and if so it executes it as PID 1.  If found, this init process is responsible for bringing the system the
rest of the way up, including locating and mounting the real root device (if any).  If rootfs does not contain an init program after the embedded cpio archive is extracted into it, the kernel will fall through to the older code to locate and mount a root partition, then exec some variant of /sbin/init
out of that.

应用

 一般initramfs+ramfs,initrd+ramdisk+(ext2,ext3,ext4)可作为rootfs。其中initramfs,initrd是一种image格式的文件,PC有相应的工具制作这些image。
tmpfs可存储设备节点,mount到/dev下。

你可能感兴趣的:(Linux ramfs,rootfs,tmpfs,ramdisk,initrd and initramfs)