SquashFS is a compressed read-only file system for Linux. SquashFS compresses files, inodes and directories, and supports block sizes up to 1 MB for greater compression. SquashFS is also the name of free/open software, licensed under the GPL, for accessing SquashFS filesystems.

 

 

SquashFS is intended for general read-only file system use and in constrained block device/memory systems where low overhead is needed.

 
SquashFS is used by the Live CD versions of Arch Linux, Debian, Fedora, Gentoo Linux, Linux Mint, Salix, Ubuntu and on embedded distributions such as the OpenWrt and DD-WRT router firmware.

 

 

It is often combined with a union mount filesystem, such as UnionFS or aufs, to provide a read-write environment for live Linux distributions. This takes advantage of both the SquashFS’s high speed compression abilities and the ability to alter the distribution while running it from a live CD. Distributions such as Debian Live, Mandriva One, Puppy Linux, Salix Live and Slax use this combination.

 

The on-disk format of SquashFS has stabilized enough that it has been merged into the 2.6.29 version of the Linux kernel. In that process, the backward-compatibility code for older formats was removed.

 

 

 

You cannot modify squashfs image directly but you can uncompress it, apply changes and compress it again.

 

 

Create temporary directory and enter it:

 

#mkdir /MINI

 

For this example , I used  SquashFileSystem of  Ubuntu Trusty Tar.  So i mounted the ISO image  of Trusty Tar  in to the /mnt directory. using

 

#mount -o loop    ubuntu14.04.iso /mnt/

 

Now i copied the  FileSystem.squashfs  from the casper folder of  newly released Ubuntu 14.04 Trusty Tar..

 

#cp  /mnt/casper/filesystem.squashfs   /MINI

 

 

For managing SquashFileSystem,  we need  squashfs-tools. So i installed it by using following command in my debian system

 

#apt-get install squashfs-tools

 

 

 

To uncompress squashfs image (into MINI directory) use unsquashfs command.  unsquashfs which extracts files from an existing squashed file system.

 

#cd  /MINI

 

#unsquashfs     /MINI/filesystem.squashfs

 

 

Screenshot from 2014-04-28 22:08:52

 

 

After the full extract it will create a squashfs-root directory, in that linux filesystem of particular distro is found. For modifing the distro we need to mount it with chroot command.

 

#mount –bind /dev    /MINI/squashfs-root/dev

#mount –bind /sys    /MINI/squashfs-root/sys

#mount –bind /proc  /MINI/squashfs-root/proc

 

#chroot  /MINI/squashfs-root

 

 

 

Screenshot from 2014-04-28 22:16:25

 

 

That’s it now you can modify  the distro  by your wish like installing , removing ,configuring anything up to you… after changes we need to umount the  squashfs-root filesystem.

 

 

#umount /MINI/squashfs-root/dev

 

#umount /MINI/squashfs-root/sys

 

#umount /MINI/squashfs-root/proc

 

 

Now it’s time to recreate the  squashfs  filesystem  after modification, for that we need mksquashfs tool.

 

mksquashfs is the tool for creating new squashed file systems, and for appending new data to existing squashed file systems

 

 
After applying required changes you can compress it using mksquashfs command:

 

#mksquashfs squashfs-root/   filesystem.squashfs  -noappend   -always-use-fragments

 

 

Screenshot from 2014-04-29 10:58:56

 

 

Now you can use this squashfs file as Live CD for installation…