Files
hpr-knowledge-base/hpr_transcripts/hpr0278.txt

57 lines
4.7 KiB
Plaintext
Raw Normal View History

Episode: 278
Title: HPR0278: Squashfs
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr0278/hpr0278.mp3
Transcribed: 2025-10-07 15:25:23
---
.
Hello and welcome to today's episode of Pack of Public Radio. I'll be your host for today DeepGeek.
Today I want to introduce you guys on the short episode of HPR to the squash file system.
The squash file system is a file system designed to take whole directories, compress them using the zip system,
and then later you can take that and mount it back onto your directory system.
This interesting file system is designed to help people create small and embedded systems,
but it's also fun to experiment with.
I found that things like text files I can get 90% of the space going with.
I found that with program files executables I can get things down to 50% of the original size.
So even to know this is made to say take your stack files, your slash usr directory, and compress it so you can put on a smaller device or take less space with it.
You can also fool around with different things.
For instance, I've already attempted to load the squash file system source file up into a RAM disk,
and experimented with mounting the RAM disk squash file system back onto the directory.
That could increase speed. You could also say copy a whole website with a tool like HTTRAC, squash down your result,
and walk around with your laptop or a USB drive with a whole website and be safe in the knowledge that you have it on a very small version
and you're not taking up space you don't need to expand.
So all this stuff, all the technical little notes will be in the show notes at hackupublicare.org.
I have links to the squashfs homepage at squashfs.sourceforge.net.
And I also have the link to the how to at TLDP.org slash how to slash squashfs-how to slash.
Now to install it, it's an apt getaway of course, like almost everything else, but you would have to find the right modules
because you have to extend your kernel by loading the correct module.
So you would first do apt-case-space-search-space-squash-sq-u-a-s-h, and that would show you all the package names with squash in it.
Now, you're going to apt get install squashfs tools because squashfs tools has MK squashfs which makes the file system.
But we also have to get the module. For me, for my particular system, it's squashfs-modules-2.6-amd,
but this might change depending on what kernel your distribution runs and what architecture your computer is on.
So that's why I give you the command to use apt-case-search.
Now, to get the kernel going, to get the kernel up to speed once you install these two packages, the modules package and the tools package,
you would add the line containing the word squashfs to the bottom of the file slash atc slash modules.
And the next time you boot Linux, it'll load the module squashfs into the kernel and you'll be able to use mount commands.
So to give you guys a quick example, I'm going to use a fictitious username called Tim and a directory called docs.
So you would, if you wanted to squash down this docs file, you would first do the confluent command, make there MKDIR,
space slash home slash Tim slash small docs.
That makes the directory where you will eventually install the compressed version of docs.
Then you would make squashfs MKSQASHFS space slash home slash Tim slash docs space slash home slash Tim slash docs.sqfs.
Then that would generate the read only file system that contains the compressed version of all these docs.
Once this example is text files, you can expect about a 90% compression.
Now to finish it off, you would mount that file onto the file system.
So do space mount space slash home slash Tim slash docs.sqfs space slash home slash Tim slash small docs space minus T space loop, which is the loop into face.
Don't worry about that's just how you get a file read back into the file system.
And then you can browse that directory in the same way you would browse any other directory.
So it's something fun, something fun to experiment with, something that you really ought to know about in case someday you need to get a small file system someplace.
And I hope you've enjoyed that little piece of information on today's short episode of Hack a Public Radio. Have a great day.
A quick correction that Mount Command should have been as you do space mount space slash home slash Tim slash docs at sqfs space slash home slash Tim slash small docs space.
Here's the correction is in the flags.
dash T space squash fs that's a file system type squash fs and space dash O space loop.
And that will mount the file system correctly. Thank you.
Thank you for listening to Hack a Public Radio.
HPR is sponsored by Carol.net. So head on over to C-A-R-O dot anything for all of us here.
Thanks for watching.