Unbind the initrd file in CentOS

Source: Internet
Author: User

We all know that initrd is a memory file system started in linux. What is in it? Today, let's take a look at how to open this file system!
Initrd = init ramdisk is a file system that exists in the memory at startup. Initrd was initially designed to split the startup of the kernel into two phases: retaining the least basic startup code in the kernel, then, the support for various hardware devices is placed in initrd as a module, so that the required modules can be loaded from the root file system mounted by initrd during startup. One advantage of this is that you can flexibly support different hardware by modifying the content in initrd without changing the kernel. At the end of the startup, the root file system can be mounted to another device.
Do I have to use initrd to start Linux?
No. If you compile all the required functions into the kernel (non-module mode), you only need one kernel file. initrd can reduce the volume of kernel startup and increase flexibility. If your kernel supports a certain file system (such as ext3 and UFS) as a module, and driver modules (such as jbd) in the startup phase are placed on these file systems, the kernel cannot read the file system. Therefore, these modules can only be loaded through the Virtual File System of initrd.
Some people may ask: Since the kernel cannot read the file system at this time, how is the kernel file loaded into the memory? The answer is simple. Grub is file-system sensitive and can identify common file systems.
How is the initrd file generated?
The mkinitrd command is actually a Bash script.
# File 'which mkinitrd'
/Sbin/mkinitrd: Bourne-Again shell script text executable
This script first creates an 8 m empty file, creates a file system, and copies the corresponding file.
A default RedHat Fedora Core 2. What is its initrd?
(Related to system hardware )?
# File initrd-2.6.5-1.358.img
Initrd-2.6.5-1.358.img: gzip compressed data, from Unix, max compression
# Mv initrd-2.6.5-1.358.img initrd-2.6.5-1.358.gz
# Gzip-d initrd-2.6.5-1.358.gz
# Ll
-Rw-r -- 1 root 8192000 Jan 14 11: 32 initrd-2.6.5-1.358
# Mkdir/mnt/loop
# Mount-o loop initrd-2.6.5-1.356/mnt/loop
............ Modify the file system in the middle ............
# Umount loop
# Cd/boot
# Gzip-9 initrd-2.6.5-1.356
# Mv initrd-2.6.5-1.356.gz initrd-2.6.5-1.356.img

Method 2:
Music initrd-2.6.5.13.58.img initrd.gz
Gzip-d initrd.gz (the package will be unlocked at this time. To an initrd file)
Mount-t proc initrd/mnt
Cd/mnt
Ls to see the content in it!

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.