Compress large data sets into multiple volume files and crypt the archive with a symmetric key encryption.


Use tar to create multi-volume archives.

Use gpg to crypt the archive. Note that gpg uses compression algorithm to compress the data before the data is encrypted.



Create multiple volumes with tar with the following command:

$ tar -c --preserve --numeric-owner -L2048 \
  -f ns2-backup.1.tar -f ns2-backup.2.tar -f ns2-backup.3.tar ./ns2

This command takes all data from local subdirectory ns2 and creates 4GB archive volumes. As a result you will get three 4GB file ns2-backup.1.tar, ns2-backup.2.tar and ns2-backup.3.tar. Tar does not prompt you for any output. The –preserve switch preserves the permissions.

The –numeric-owner sets numeric IDs instead of user names.

-L sets the number of bytes of a single archive.


Now you can crypt the archives with the following command:

$ gpg -c ns2-backup.1.tar

The command will ask you twice for your pass phrase. Then it starts the encryption.

Caution: Before you delete your archived data, make sure you can recover your data from created archives (first from gpg and then from tar).


  1. tar – Using Multiple Tapes.
  2. GnuPG Homepage.
Creating and crypting multiple volumes with tar

Leave a Reply

Your email address will not be published. Required fields are marked *