p-static
p-static

Reputation: 549

Reading a SquashFS archive

(SquashFS is a compressed filesystem - http://en.wikipedia.org/wiki/SquashFS)

I'm looking for a way to read a SquashFS filesystem from a program. So far, I've know about the in-kernel drivers for it, but I'm sure that a userspace library for it must exist somewhere. Any language would be fine, but C is preferred.

Just mounting the filesystem and using it that way is technically possible, but I'd rather avoid that route because the application I'm looking at would involve working with at least a few dozen archives at any given time.

Upvotes: 7

Views: 8383

Answers (3)

John Kugelman
John Kugelman

Reputation: 361556

mksquashfs and unsquashfs are packaged as "squashfs-tools" on my Red Hat system:

Name        : squashfs-tools
Group       : System Environment/Base
Size        : 160923
URL         : http://squashfs.sf.net
Summary     : squashfs utilities
Description :

Squashfs is a highly compressed read-only filesystem for Linux. This package contains the utilities for manipulating squashfs filesystems.

/sbin/mksquashfs
/usr/sbin/unsquashfs
/usr/share/doc/squashfs-tools-3.0
/usr/share/doc/squashfs-tools-3.0/ACKNOWLEDGEMENTS
/usr/share/doc/squashfs-tools-3.0/CHANGES
/usr/share/doc/squashfs-tools-3.0/COPYING
/usr/share/doc/squashfs-tools-3.0/PERFORMANCE.README
/usr/share/doc/squashfs-tools-3.0/README

Be warned that squashing and unsquashing are painfully slow. It takes several minutes for a script I wrote to unsquash, modify, and re-squash an 87M stage2.img file.

Upvotes: 1

Yann Ramin
Yann Ramin

Reputation: 33167

There is a tool called unsquashfs which extracts the squashfs image akin to tar. It should be bundled with mksquashfs

Upvotes: 6

Nicolás
Nicolás

Reputation: 7523

I just downloaded the code tarball from squashfs.sourceforce.net and there is no kernel code in there. Only userland code in C for mksquashfs and unsquashfs.

You could probably extract code from unsquashfs.

Upvotes: 5

Related Questions