- [Instructor] Let's now move on to the next video
of this section,
Creating file systems with Compression.
In the previous video,
we looked at faster archiving with Pbzip2.
In this video,
we'll see how to create file systems with compresison,
by using squashfs command.
Squashfs is a heavy compression-based read-only file system,
that's capable of compressing two to three gig of data
onto a 700 megabyte file.
If you've ever used a Linux Live CD or Live USB,
they're built using squashfs.
These CDs make use of a read-only compressed file system,
which keeps the root file system on a compressed file.
It can be loop back mounted,
and loads a complete Linux environment.
Thus, when some files are required by processes,
they're decompressed and loaded into the RAM and used.
Squashfs can be used for when it's required
to keep files heavily compressed,
and to access a few of them
without extracting all the files.
This is because completely extracting
a large compressed archive,
takes a long time.
However, if an archive is loop back mounted,
will be very fast,
since only the required portion of the compressed archive,
is decompressed when requested.
Let's see how we can use squashfs.
Squashfs internally uses compression algorithms,
such as gzip and lzma,
and is supported in all modern Linux distros.
However, in order to create squashfs files,
we need to install squashfs tools,
using the Package Manager.
So, I've just installed squashfs-tool.
Let's see how to create and mount squashfs files.
So, in order to create a squashfs file,
we need to add source directories and files.
Use this command line.
Sources can be wildcards, or files, or folder paths.
For example, see this one here.
More details will be printed on the terminal,
the output is stripped to save space.
Now, to mount this squashfs file to a mount point,
use loop back mounting as here.
You can also access the content,
such as slash mt, slash squashfs.
The squashfs file system can be customized
by specifying additional parameters.
Let's go through the additional options.
Let's now look into excluding files
while creating a squashfs file.
So, while creating a squashfs file,
we can exclude a list of files or a file pattern,
using wildcards.
So to exclude a list of files
specified as command line arguments,
use the minus E option.
For example, see this one here.
The minus E option is used to exclude password
and shadow files.
It's also possible to specify
a list of exclude files given in a file,
with minus EF, as this.
If we want to support wildcard and exclude lists,
use minus wildcard as an argument.
Superb, in this video we've created file systems
with Compression,
by using squashfs command.
In the next video, we'll see
how to back up Snapshots with rsync.