{"id":588,"date":"2014-10-14T14:27:29","date_gmt":"2014-10-14T14:27:29","guid":{"rendered":"http:\/\/www.selinuxplus.com\/?p=588"},"modified":"2014-10-14T14:27:29","modified_gmt":"2014-10-14T14:27:29","slug":"linux-%e7%b3%bb%e7%bb%9f%e7%ae%a1%e7%90%86el7-squashfs%e7%af%87","status":"publish","type":"post","link":"http:\/\/www.selinuxplus.com\/?p=588","title":{"rendered":"Linux \u7cfb\u7edf\u7ba1\u7406(EL7)-squashfs\u7bc7"},"content":{"rendered":"<h1>1 \u00a0\u6982\u8ff0<\/h1>\n<h2>1.1 \u00a0 \u529f\u80fd\u4ecb\u7ecd<\/h2>\n<p>Squashfs\uff08.sfs\uff09\u662f\u4e00\u5957\u4f9bLinux\u6838\u5fc3\u4f7f\u7528\u7684GPL\u5f00\u6e90\u53ea\u8bfb\u538b\u7f29\u6587\u4ef6\u7cfb\u7edf\u3002Squashfs\u80fd\u591f\u4e3a\u6587\u4ef6\u7cfb\u7edf\u5185\u7684\u6587\u4ef6\u3001inode\u53ca\u76ee\u5f55\u7ed3\u6784\u8fdb\u884c\u538b\u7f29\uff0c\u5e76\u652f\u6301\u6700\u59271024\u5343\u5b57\u8282\u7684\u533a\u6bb5\uff0c\u4ee5\u63d0\u4f9b\u66f4\u5927\u7684\u538b\u7f29\u6bd4\u3002<\/p>\n<p>Squashfs\u7684\u8bbe\u8ba1\u662f\u4e13\u95e8\u4e3a\u4e00\u822c\u7684\u53ea\u8bfb\u6587\u4ef6\u7cfb\u7edf\u7684\u4f7f\u7528\u800c\u8bbe\u8ba1\uff0c\u5b83\u53ef\u5e94\u7528\u4e8e\u6570\u636e\u5907\u4efd\uff0c\u6216\u662f\u7cfb\u7edf\u8d44\u6e90\u7d27\u5f20\u7684\u7535\u8111\u4e0a\u4f7f\u7528\u3002\u6700\u521d\u7248\u672c\u7684Squashfs\u91c7\u7528 gzip \u7684\u6570\u636e\u538b\u7f29\u3002\u7248\u672c 2.6.34 \u4e4b\u540e\u7684Linux\u5185\u6838\u589e\u52a0\u4e86\u5bf9 LZMA\u548c LZO \u538b\u7f29\u7b97\u6cd5\u7684\u652f\u6301\uff0c\u7248\u672c 2.6.38 \u7684\u5185\u6838\u589e\u52a0\u4e86\u5bf9LZMA2\u7684\u652f\u6301\uff0c\u8be5\u7b97\u6cd5\u540c\u65f6\u4e5f\u662fxz\u4f7f\u7528\u7684\u538b\u7f29\u7b97\u6cd5\u3002<\/p>\n<p>\u672c\u6587\u7528\u5230\u4f7f\u7528Squashfs\u5236\u4f5c\u7684LiveCD\u6280\u672f\uff0c\u8be5\u6280\u672f\u5c06root\u6587\u4ef6\u7cfb\u7edf\u4fdd\u5b58\u5728\u4e00\u4e2a\u538b\u7f29\u8fc7\u7684\u6587\u4ef6\u7cfb\u7edf\u6587\u4ef6\u4e2d\u3002\u8fd9\u4e2a\u6587\u4ef6\u53ef\u4ee5\u4f7f\u7528\u73af\u56de\u7684\u5f62\u5f0f\u6765\u6302\u8f7d\u5e76\u5bf9\u5176\u4e2d\u7684\u6587\u4ef6\u8fdb\u884c\u8bbf\u95ee\u3002\u56e0\u4e3a\u5f53\u8fdb\u7a0b\u9700\u8981\u67d0\u4e9b\u6587\u4ef6\uff0c\u53ef\u4ee5\u5c06\u5b83\u4eec\u89e3\u538b\uff0c\u7136\u540e\u8f7d\u5165\u5185\u5b58\u4e2d\u4f7f\u7528\u3002<\/p>\n<p>\u672c\u6587\u6682\u65f6\u4e0d\u4ecb\u7ecd\u600e\u4e48\u5236\u4f5cLiveCD\u6280\u672f\uff0c\u800c\u662f\u4ecb\u7ecd\u5bf9LiveOS\u6587\u4ef6\u7684\u64cd\u4f5c\u3002<\/p>\n<pre class=\"lang:default decode:true \" >\u5b98\u7f51\u5730\u5740\uff1ahttp:\/\/sourceforge.net\/p\/squashfs\/wiki\/Home\/\r\nWiki: http:\/\/zh.wikipedia.org\/zh-cn\/SquashFS<\/pre>\n<h2>1.2\u00a0\u5de5\u7a0b\u4f9d\u8d56<\/h2>\n<p>Grub2-theme \u4f9d\u8d56grub2\u7684\u4f7f\u7528\u3002<\/p>\n<h1>2 \u00a0\u73af\u5883\u642d\u5efa<\/h1>\n<h2>2.1 \u73af\u5883\u8981\u6c42<\/h2>\n<pre class=\"lang:default decode:true \" >\u57fa\u7840\u7cfb\u7edf EL7\uff0cor SELINUXPLUS.COM Cloud 7\u3002\r\n\u8f6f\u4ef6\u5305 squashfs-tools <\/pre>\n<h2>2.2 \u73af\u5883\u642d\u5efa<\/h2>\n<p>1 \u5b89\u88c5\u8f6f\u4ef6\u5305<\/p>\n<pre class=\"lang:default decode:true \" >Yum install squashfs-tools -y<\/pre>\n<p>2 \u89e3\u538bLiveOS<\/p>\n<pre class=\"lang:default decode:true \" >[root@ucsm02 LiveOS]# file squashfs.img\r\nsquashfs.img: Squashfs filesystem, little endian, version 4.0, 292275192 bytes, 3 inodes, blocksize: 131072 bytes, created: Fri Jul\u00a0 4 23:55:59 2014\r\n[root@SELinuxplus.com197 opt]# unsquashfs\u00a0 squashfs.img\r\nParallel unsquashfs: Using 2 processors\r\n1 inodes (16384 blocks) to write\r\n[===========================================================|] 16384\/16384 100%\r\ncreated 1 files\r\ncreated 2 directories\r\ncreated 0 symlinks\r\ncreated 0 devices\r\ncreated 0 fifos\r\ncusmtom anaconda<\/pre>\n<h2>2.3\u4f7f\u7528\u6587\u4ef6<\/h2>\n<pre class=\"lang:default decode:true \" >1 \u6587\u4ef6\u5728\u91cc\u9762rootfs.img\u7684\u5b58\u50a8\u65b9\u5f0f\u548c\u7ed3\u6784 \uff1a\r\n [root@localhost LiveOS]# file rootfs.img\r\nrootfs.img: Linux rev 1.0 ext4 filesystem data, UUID=a6108b67-239e-42bf-9229-85d163e216a3, volume name \"Anaconda\" (needs journal recovery) (extents) (64bit) (huge files)\r\n2\u3001 mount rootfs.img\u00a0 test -o loop\r\n3\u3001[root@localhost test]# ll\r\ntotal 26\r\nlrwxrwxrwx.\u00a0 1 root root\u00a0\u00a0\u00a0\u00a0 7 Jul\u00a0 4 23:43 bin -&amp;gt; usr\/bin\r\ndrwxr-xr-x.\u00a0 2 root root\u00a0 1024 Jul\u00a0 4 23:48 dev\r\ndrwxr-xr-x. 93 root root\u00a0 5120 Aug 14 17:20 etc\r\nlrwxrwxrwx.\u00a0 1 root root\u00a0\u00a0\u00a0 12 Jul\u00a0 4 23:50 firmware -&amp;gt; lib\/firmware\r\nlrwxrwxrwx.\u00a0 1 root root\u00a0\u00a0\u00a0\u00a0 7 Jul\u00a0 4 23:43 lib -&amp;gt; usr\/lib\r\nlrwxrwxrwx.\u00a0 1 root root\u00a0\u00a0\u00a0\u00a0 9 Jul\u00a0 4 23:43 lib64 -&amp;gt; usr\/lib64\r\ndrwx------.\u00a0 2 root root 12288 Jul\u00a0 4 23:51 lost+found\r\ndrwxr-xr-x.\u00a0 2 root root\u00a0 1024 Jul\u00a0 4 23:50 mnt\r\nlrwxrwxrwx.\u00a0 1 root root\u00a0\u00a0\u00a0 11 Jul\u00a0 4 23:50 modules -&amp;gt; lib\/modules\r\ndr-xr-xr-x.\u00a0 2 root root\u00a0 1024 Jun 10 08:11 proc\r\ndr-xr-x---.\u00a0 2 root root\u00a0 1024 Jul\u00a0 4 23:50 root\r\ndrwxr-xr-x. 19 root root\u00a0 1024 Jul\u00a0 4 23:46 run\r\nlrwxrwxrwx.\u00a0 1 root root\u00a0\u00a0\u00a0\u00a0 8 Jul\u00a0 4 23:43 sbin -&amp;gt; usr\/sbin\r\ndr-xr-xr-x.\u00a0 2 root root\u00a0 1024 Jun 10 08:11 sys\r\ndrwxrwxrwt.\u00a0 7 root root\u00a0 1024 Jul\u00a0 4 23:51 tmp\r\ndrwxr-xr-x. 10 root root\u00a0 1024 Jul\u00a0 4 23:51 usr\r\ndrwxr-xr-x. 10 root root\u00a0 1024 Jul\u00a0 4 23:51 var&lt;\/td&gt;<\/pre>\n<p>\u538b\u7f29\u6587\u4ef6\uff1a<\/p>\n<pre class=\"lang:default decode:true \" >mksquashfs rootfs.img suqashfs.img<\/pre>\n<h2>2.4\u5de5\u7a0b\u8c03\u8bd5<\/h2>\n<p>1\u3001\u5de5\u7a0b\u8c03\u8bd5\u8fd0\u884c\u65f6\u9700\u8981\u542f\u52a8\u5b89\u88c5\u7a0b\u5e8f\uff0c\u5efa\u8bae\u4f7f\u7528\u7f51\u7edc\u5b89\u88c5<\/p>\n<h2>2.5\u5176\u4ed6\u4e8b\u9879<\/h2>\n<p>1\u3001\u7cfb\u7edf\u538b\u7f29\u6587\u4ef6\u65f6\uff0c\u7531\u4e8emksquashfs\u652f\u6301\u591a\u79cd\u538b\u7f29\u7b97\u6cd5\uff0c\u9009\u7528vmlinz\u53ef\u4ee5\u652f\u6301\u7684\u7b97\u6cd5\u3002\u5982\u4e0d\u6e05\u695a\u9009\u7528\u9ed8\u8ba4\u7b97\u6cd5\u3002<\/p>\n<h2>2.6 \u5176\u4ed6<\/h2>\n<p>\u63cf\u8ff0\u9879\u76ee\u7814\u5236\u8fc7\u7a0b\u4e2d\u5c06\u91c7\u7528\u7684\u5176\u4ed6\u65b9\u9762\u7684\u5185\u5bb9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1 \u00a0\u6982\u8ff0 1.1 \u00a0 \u529f\u80fd\u4ecb\u7ecd Squashfs&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[125,124,106,123],"_links":{"self":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/588"}],"collection":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=588"}],"version-history":[{"count":1,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/588\/revisions"}],"predecessor-version":[{"id":589,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/588\/revisions\/589"}],"wp:attachment":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=588"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}