模拟虚拟的文件系统initrd/initramfs

请看initramfs文件的以下解析:

 1 [root@ant-colonies boot]# ls
 2 config-2.6.32-573.el6.x86_64         lost+found
 3 efi                                  symvers-2.6.32-573.el6.x86_64.gz
 4 grub                                 System.map-2.6.32-573.el6.x86_64
 5 initramfs-2.6.32-573.el6.x86_64.img  vmlinuz-2.6.32-573.el6.x86_64
 6 [root@ant-colonies boot]# file initramfs-2.6.32-573.el6.x86_64.img 
 7 initramfs-2.6.32-573.el6.x86_64.img: gzip compressed data, from Unix, last modified: Thu Jan 19 21:36:05 2017, max compression
 8 [root@ant-colonies boot]# mkdir /initrd
 9 [root@ant-colonies boot]# cp initramfs-2.6.32-573.el6.x86_64.img /initrd
10 [root@ant-colonies boot]# cd /initrd
11 [root@ant-colonies initrd]# mv initramfs-2.6.32-573.el6.x86_64.img initramfs-2.6.32-573.el6.x86_64.gz
12 [root@ant-colonies initrd]# gunzip initramfs-2.6.32-573.el6.x86_64.gz
13 [root@ant-colonies initrd]# ls
14 initramfs-2.6.32-573.el6.x86_64
15 [root@ant-colonies initrd]# file initramfs-2.6.32-573.el6.x86_64 
16 initramfs-2.6.32-573.el6.x86_64: ASCII cpio archive (SVR4 with no CRC)
initramfs-2.6.32-573.el6.x86_64.img解压缩解析

 由以上图示可以看出:虚拟文件系统模拟的就是根的启动过程

下面通过chroot来模拟一个虚拟的文件系统(虚拟根):

原文地址:https://www.cnblogs.com/ant-colonies/p/6476147.html