- Create a squashfs file by adding source directories and files with the mksquashfs command:
$ mksquashfs SOURCES compressedfs.squashfs
Sources can be wildcards, files, or folder paths.
Consider this example:
$ sudo mksquashfs /etc test.squashfs
Parallel mksquashfs: Using 2 processors
Creating 4.0 filesystem on test.squashfs, block size 131072.
[=======================================] 1867/1867 100%
More details will be printed on the terminal. The output is stripped to save space.
- To mount the squashfs file to a mount point, use loopback mounting, as follows:
# mkdir /mnt/squash
# mount -o loop compressedfs.squashfs /mnt/squash
You can access the contents at /mnt/squashfs.