• squashfs文件系统初识


    日期: 2008.07.08 16:36
     
      squashfs其实对于我们来说并不陌生,live cd或是安装cd都是我们学习linux必经的一步。本人接触这个文件系统是对安装盘的认识开始的。以asianux2.0或3.0为例,同理可以用于一切red hat发行版。squashfs 是在linux下将目录或文件打包成只读文件系统。如果你想实现压缩的话,需要kernel的支持,请访问如下链接:
    http://www.squashfs-lzma.org/
       以下是官方的对其特性的描述:Data, inodes and directories are compressed.
    Squashfs stores full uid/gids (32 bits), and file creation time.
    Files up to 2^64 bytes are supported.  Filesystems can be up to 2^64 bytes.
    Inode and directory data are highly compacted, and packed on byte
    boundaries.  Each compressed inode is on average 8 bytes in length (the exact
    length varies on file type, i.e. regular file, directory, symbolic link,
    and block/char device inodes have different sizes).
    Squashfs can use block sizes up to 1Mbytes (the default size is 128K).
    Using 128K blocks achieves greater compression ratios than the normal 4K
    block size.
    File duplicates are detected and removed.
    Both big and little endian architectures are supported.  The mksquashfs
    program can generate filesystems for different endian architectures for
    cases where the host byte ordering is different to the target.  This is
    useful for embedded systems.
    squashfs可完整的存储uid/gid和文件建立的时间。支持2的64次方byte的文件。可以指定block大小来打包。另外LZMA还有一个权威的表格beachmark.
    此处我们不谈LZMA,只谈squashfs能起到什么作用。
    在安装盘的根目录里,有这么一个文件/images/stage2.img
    lee@lee-laptop:/media/sda6/lee/tmp/anaconda$ file stage2.img 
    stage2.img: Squashfs filesystem, little endian, version 3.0, 68102631
    bytes, 4938 inodes, blocksize: 65536 bytes, created: Wed Aug 29
    16:58:29 2007
    lee@lee-laptop:/media/sda6/lee/tmp/anaconda$ sudo mount -t squashfs -o loop stage2.img stage2lee@lee-laptop:/media/sda6/lee/tmp/anaconda$ du -sh stage2175M    stage2lee@lee-laptop:/media/sda6/lee/tmp/anaconda$ du -sh stage2.img 66M    stage2.imglee@lee-laptop:/media/sda6/lee/tmp/anaconda/stage2$ ls
    etc  lib  modules  proc  usr  var
    这就是我们的安装程序的运行根目录!包括安装程序anaconda.busybox等程序。
    这个东西最大的作用就是其只读,不管你是什么用户,所有的文件和目录都是只读的。
    如果你想实现自己的东西不被修改,那么就用这个文件系统吧。      如果想将自己的发行版做成live-cd的话,请将你的内核打上支持LZMA的patch.
  • 相关阅读:
    JS 知识点补充
    JS 数据之间类型的转化
    JS 数据的类型
    数据结构--数组、单链表和双链表介绍 以及 双向链表
    数据结构--队列
    数据结构--栈
    24. 两两交换链表中的节点
    23. 合并K个排序链表
    22. 括号生成
    21. 合并两个有序链表
  • 原文地址:https://www.cnblogs.com/huapox/p/3299982.html
Copyright © 2020-2023  润新知