Skip to main content

Creating compressed File-Systems in Linux with SquashFS

By October 21, 2013September 12th, 2022No Comments

In this video we are going to take a quick look at the squashfs. This is a little like tar and gzip but with the added advantage that we are creating a compressed filesystem that can be mounted. The complete filesystem is stored in a single file and can be mounted similarly to an ISO file. An ISO file though is not compressed. In short squashfs is combining the best of ISO file and tar / gzip to make a very useful tool.

We start on SUSE by install the squashfs with

zypper in squashfs

Once installed we can create compressed file-systems with mksquashfs, for example

mksquashfs /etc /root/etc.sqsh

Will create a compressed archive of the /etc directory and save it to /root/etc.sqsh

We can mount these compressed file with the loopback adapter s little like we would ISO file

mount -o loop /root/etc.sqsh /mnt