Skip to content

darfire/sparsify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Sparsify files with contiguous zero regions

There are situations when you have a file with a lot of zeros, and you want to compress it. This is a simple utility that will compress the file by removing the contiguous zero regions.

It is especially useful for core dumps, memory dumps, and other files that contain a lot of zeros.

Usage

$ sparsify --block-size <block_size> --input <input_file> --output <output_file>
  • block_size - the size of the blocks that will be checked for zeros and sparsified
  • input_file - the file that will be sparsified; it can be - for stdin
  • output_file - the file where the sparsified data will be written

Usage for core dumps

In linux you can pipe the core dump through sparsify to avoid writing the zeros to disk by setting the following value in /proc/sys/kernel/core_pattern:

|/path/to/sparsify --block-size 4096 --input - --output /path/to/output_file

Example:

echo "|/usr/local/bin/sparsify --block-size 4096 --input - --output /var/cores/core.%p.%e.%t" > /proc/sys/kernel/core_pattern

About

Transform file made up of mostly zeros into a sparse file. Useful for really big core dumps.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages