OESF Portables Forum

Everything Else => General Support and Discussion => Zaurus General Forums => Archived Forums => Software => Topic started by: Snappy on February 01, 2007, 05:49:57 pm

Title: How To: Create And Mount A Squashfs Image
Post by: Snappy on February 01, 2007, 05:49:57 pm
Hi all,

I didn't really see a squashfs tutorial thread on the forum, so I thought I'll do one.

Most of the info is available from mksquashfs --help but I also gleaned from
http://www.artemio.net/projects/linuxdoc/s...ml#mksqoverview (http://www.artemio.net/projects/linuxdoc/squashfs/SquashFS-HOWTO.html#mksqoverview)
For what squashfs is about and why you might want to use it, see the next post.

1. Install mksquashfs if it's not installed already.
2. Create a mksquashfs image

eg, you want to create an image based on a directory 'myfiles'
Code: [Select]
$ mksquashfs myfiles/ myfiles.squashfs
Creating little endian 2.1 filesystem on ati.squashfs, block size 65536.

Little endian filesystem, data block size 65536, compressed data, compressed metadata, compressed fragments
Filesystem size 12785.03 Kbytes (12.49 Mbytes)         27.52% of uncompressed filesystem size (46448.82 Kbytes)
Inode table size 17172 bytes (16.77 Kbytes)         33.86% of uncompressed inode table size (50709 bytes)
Directory table size 13324 bytes (13.01 Kbytes)         35.20% of uncompressed directory table size (37853 bytes)
Number of duplicate files found 4
Number of inodes 2118
Number of files 1889
Number of fragments 400
Number of symbolic links  0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 229
Number of uids 1         root (0)
Number of gids 0

If yours went through, you should get an image file myfiles.squashfs.

3. Mount the image
Code: [Select]
# mkdir /mnt/mydir
# mount myfiles.sqsh /mnt/mydir -t squashfs -o loop

That's it! Now when you look into /mnt/mydir, you should see the original directory structure with files in it.

For more on loop devices, you can refer to meanie's site or search google.

TIP: Meanie's pdaXqtrom for cacko creates additional loop devices.
Title: How To: Create And Mount A Squashfs Image
Post by: Snappy on February 01, 2007, 06:00:45 pm
Squashfs simply allows you to create an image for a whole directory, partition or filesystem into an image, partition or filesystem. The example above compresses a whole directory into a single read-only image file. This image is then mounted and the files and directory structure can be accessed directly as before.

The advantage (for me anyway) is that a lot of space is saved! In my case, the original directory was 40+mb, while the image was 12mb!

YMMV, so if your files can benefit from compression and are not changed often, and you don't need to modify the files, then squashfs may be for you.
Title: How To: Create And Mount A Squashfs Image
Post by: speculatrix on February 14, 2007, 06:46:13 pm
thanks for this. I started writing up a quick guide on my website to document how I did the oesf forum archive.
Title: How To: Create And Mount A Squashfs Image
Post by: Snappy on February 14, 2007, 07:25:44 pm
Quote
thanks for this. I started writing up a quick guide on my website to document how I did the oesf forum archive.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=154149\"][{POST_SNAPBACK}][/a][/div]

Great!

Was looking around as well for RW compressed format and found that jffs3 or something provides journalling and compression in RW format. Wonder if anyone tried that?
Title: How To: Create And Mount A Squashfs Image
Post by: Meanie on February 28, 2007, 08:59:25 pm
Quote
Quote
thanks for this. I started writing up a quick guide on my website to document how I did the oesf forum archive.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=154149\"][{POST_SNAPBACK}][/a][/div]

Great!

Was looking around as well for RW compressed format and found that jffs3 or something provides journalling and compression in RW format. Wonder if anything tried that?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=154165\"][{POST_SNAPBACK}][/a][/div]

jffs2 is what is used on the NAND afaik, jffs2/jffs3 can only be installed on a device like the NAND....
Title: How To: Create And Mount A Squashfs Image
Post by: speculatrix on March 02, 2007, 06:30:55 pm
I imagine you can do a loopback mount of jffsX images as well, however, it's probably not the best way to use them, they're designed specifically for putting directly onto flash block devices to level wear and recover from bad blocks?
Title: How To: Create And Mount A Squashfs Image
Post by: Snappy on March 04, 2007, 07:30:38 pm
hmmm ... guess have to keep looking ...

Makes me miss doublespace and stacker ... for those who still recall those 'huge' 40mb hdd in DOS days!