The tar command line utility was first introduced in 1979 as a method of collecting many files into one archive file for distrbution and backup purposes. With the penetration of big data into every facet of the computing space datasets have grown exponentially in size. The single-threaded tar implementation is too slow to effectively archive terrabyte sized directories with millions of files. We introduce ptgz, a custom multi-threaded C++ file archiving utility to quickly compress, bundle files into an archive file, developed at the National Center for Supercomputing Applications.
- C compiler with C++11 support.
- OpenMP
- MPI
make
make install
Other compilers and flags can be used if desired. Simply set CC and CFLAGS when calling make.
If you are compressing, your current working directory should be the parent directory of all directories you want to archive. If you are extracting, your current working directory should be the same as your archive.
ptgz will not preserve symlinks in the ptgz.tar archive. Instead, all symlinks will be replaced by copies of what is being symlinked to. Archives for directories with a lot of symlinks can turn out to be a lot bigger than expected.
ptgz [-c | -d </path/to/directory> | -k | -v | -x | -W] <archive>
-c Compression Will perform file compression. The current directory and all of it's
children will be archived and added to a single tarball. <archive> will be
prefix of the ptgz archive created.
-d Remote Directory ptgz will compress and bundle a specified directory from a provided path.
-k Keep Archive Does not delete the ptgz archive it has been passed to extract. This option
must be used with "-x".
-l Set Level Instruct ptgz to use a specific compression level. Value must be from 1 to 9
1 is low compression, fast speed and 9 is high compression, low speed.
-v Enable Verbose Will print the archive and removal commands as they are called to STDOUT.
-x Extraction Signals for file extraction from an archive. The passed ptgz archive will be
unpacked and split into its component files. <archive> should be the name of
the archive to extract.
-W Verify Archive Attempts to verify the archive after writing it.
- Single node, single threaded recursive traversal from the parent directory to build a record of all files.
- The list of files is shuffled into random indexes in order to balance each compressed archive.
- Single node, multi-threaded write to *.ptgz.tmp files, which lists the files to be included in each *.ptgz.tar.gz archive.
- Multi-node, multi-threaded use of tar with level 1 (40% of original file size) gzip compression into *.ptgz.tar.gz archives.
- Multi-node, maximum multi-rank per node use of mpitar to package all *.ptgz.tar.gz archives into a single *.ptgz.tar.
The compression process also includes in the *.ptgz.tar archive:
- *.sh: A tar-compatible single-threaded unpacking shell script if ptgz is not available.
- *.idx: An index file of files contained within the *.ptgz.tar archive. Each file is indexed by its *.ptgz.tar.gz archive location.
- *.ptgz.idx: An index of all *.ptgz.tar.gz archives included that is used for *.ptgz.tar archive extraction.
- *.ptgz.tar.idx: An index file from mpitar which lists all of the *.ptgz.tar.gz archives included in the *.ptgz.tar archive and their starting byte location.
- Single node, single threaded extraction *.ptgz.idx file from *.ptgz.tar archive.
- Multi-node, multi-threaded extraction of *.ptgz.tar.gz archives from *.ptgz.tar archive using information from *.ptgz.idx file.
- Multi-node, multi-threaded extraction of all files in all *.ptgz.tar.gz archives.
- Combine Makefiles
- Convert mpitar.cc (remove INIT and change main to function)
- Finish mpitar.hh