Linux command
mksquashfs 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Example
mksquashfs [path/to/source1] [path/to/source2] [filesystem.squashfs]
Example
mksquashfs [path/to/source] [filesystem.squashfs] -comp [gzip|lzo|lz4|xz|zstd]
Exclude
mksquashfs [path/to/source] [filesystem.squashfs] -e [file_or_dir1] [file_or_dir2]
Example
mksquashfs [path/to/source] [filesystem.squashfs] -wildcards -e "[*.gz]"
Example
mksquashfs [path/to/source] [filesystem.squashfs] -regex -e "[pattern]"
Example
mksquashfs [path/to/source] [filesystem.squashfs] -b [256K]
Example
mksquashfs [path/to/source] [filesystem.squashfs] -noappend
说明
mksquashfs creates and appends to squashfs filesystems. Squashfs is a highly compressed, read-only filesystem commonly used for live CDs, embedded systems, and application packaging (AppImage, snap). The tool compresses files, inodes, and directories using configurable algorithms. It supports deduplication, extended attributes, and efficient storage of sparse files. Block compression allows random access to compressed data.
参数
- -comp _method_
- Compression algorithm: gzip (default), lzo, lz4, xz, zstd, lzma
- -b _size_
- Data block size; default 128 Kbytes, maximum 1 Mbyte. K/M suffixes supported
- -e _items_
- Exclude specified files and directories
- -wildcards
- Enable glob pattern matching for exclusions
- -regex
- Use POSIX regular expressions for exclusions
- -all-root
- Make all files owned by root
- -force-uid _user_
- Override file owner user
- -force-gid _group_
- Override file owner group
- -processors _num_
- Number of compression threads
- -mem _size_
- Set cache memory size
- -noI
- Disable inode compression
- -noD
- Disable data compression
- -noF
- Disable fragment compression
- -noX
- Disable extended attribute compression
- -no-compression
- Disable all compression
- -noappend
- Do not append to existing filesystem; create a new one
- -info
- Print files written to filesystem
- -no-recovery
- Do not generate a recovery file
- -recover _file_
- Recover filesystem using a recovery file
- -xattrs
- Store extended attributes (default)
- -no-xattrs
- Do not store extended attributes
- -tar
- Read uncompressed tar archive from stdin
- -quiet
- Suppress verbose output
- -progress
- Display progress bar
FAQ
What is the mksquashfs command used for?
mksquashfs creates and appends to squashfs filesystems. Squashfs is a highly compressed, read-only filesystem commonly used for live CDs, embedded systems, and application packaging (AppImage, snap). The tool compresses files, inodes, and directories using configurable algorithms. It supports deduplication, extended attributes, and efficient storage of sparse files. Block compression allows random access to compressed data.
How do I run a basic mksquashfs example?
Run `mksquashfs [path/to/source1] [path/to/source2] [filesystem.squashfs]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -comp _method_ do in mksquashfs?
Compression algorithm: gzip (default), lzo, lz4, xz, zstd, lzma