{"id":841,"date":"2016-11-07T10:37:00","date_gmt":"2016-11-07T07:37:00","guid":{"rendered":"https:\/\/oss-it.su\/?p=841"},"modified":"2022-01-06T01:48:24","modified_gmt":"2022-01-05T22:48:24","slug":"%d1%80%d0%b5%d0%b4%d0%b0%d0%ba%d1%82%d0%b8%d1%80%d0%be%d0%b2%d0%b0%d0%bd%d0%b8%d0%b5-%d1%81%d0%be%d0%b4%d0%b5%d1%80%d0%b6%d0%b0%d0%bd%d0%b8%d1%8f-squashfs","status":"publish","type":"post","link":"https:\/\/oss-it.su\/en\/841","title":{"rendered":"How to write\/make changes to an existing squashfs filesystem"},"content":{"rendered":"<p>Most LiveCD distributions (Debian, Ubuntu, Fedora, Mint, etc) contain a filesystem.squashfs file, which is a <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Squashfs\">container with a squeeze file system<\/a> that is unzipped and loaded when the LiveCD boots. The following will describe how to add\/remove and edit files in such a container.<\/p>\n<p>To update the contents of squashfs you must install the <code>squashfs-tools<\/code> package; most popular Linux distributions have this package. Then go to the directory where filesystem.squashfs is located and log into a super-user session:<\/p>\n<p><code>cd ~\/work_dir<br \/>\nsu<\/code><\/p>\n<p>and unpack the container:<\/p>\n<p><code>unsquashfs filesystem.squashfs<\/code><\/p>\n<p>And immediately afterwards delete or move the original file to another folder:<\/p>\n<p><code>mv filesystem.squashfs ~\/backup\/<\/code><\/p>\n<p>After unpacking, a directory <code>squashfs-root<\/code> will appear in the folder where the original container was located &#8211; modify it as you need to: add, remove, edit its contents.<\/p>\n<p>When all necessary changes have been made, you can recreate the updated squashfs-container file:<\/p>\n<p><code>mksquashfs squashfs-root filesystem.squashfs -b 1024k -comp xz -Xbcj x86 -e boot<\/code><\/p>\n<p>This will take a while, but it should give you an updated filesystem.squashfs. If you want to add this to an existing iso image, you can do so with the handy <code>isomaster<\/code> gui tool.<\/p>\n<p>It is important to do all these commands as root. If done as a normal user, squashfs will rebuild, but the <code>su<\/code> and <code>sudo<\/code> programs may not work on the live system as a result.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most LiveCD distributions (Debian, Ubuntu, Fedora, Mint, etc) contain a filesystem.squashfs file, which is a container with a squeeze file system that is unzipped and loaded when the LiveCD boots. The following will describe how to add\/remove and edit files in such a container.<\/p>\n","protected":false},"author":1,"featured_media":846,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-841","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-system"],"_links":{"self":[{"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/posts\/841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/comments?post=841"}],"version-history":[{"count":10,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/posts\/841\/revisions"}],"predecessor-version":[{"id":1106,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/posts\/841\/revisions\/1106"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/media\/846"}],"wp:attachment":[{"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/media?parent=841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/categories?post=841"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/tags?post=841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}