Question


What is backup compression and how can I compress backups?


Environment


CentOS 6/7


Answer


Backup compression allows you to reduce the storage space used by your backup files and thus increase the backup speed. The most common tool to compress backups on the backup server is gzip, but it does not develop the data compression full potential. To increase your backup speed, it is recommended to compress backups using pigz instead of gzip. Pigz or parallel implementation of gzip is a functional replacement that uses multiple cores that significantly reduces the time needed for the backup creation.

Enable Pigz Instead of Gzip

To enable pigz and force its usage across the whole server:

  1. Download and install EPEL repository files:
    RHEL/CentOS 6

    # yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
    CODE

    • RHEL/CentOS 7

    # yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    CODE
  2. Install pigz from the EPEL repository:

    # yum install pigz
    CODE
  3. Make a copy by renaming gzip to gzip.bin:

    # mv /bin/gzip /bin/gzip.bin
    CODE
  4. Create a link pointing to pigz:

    # ln -s /usr/bin/pigz /bin/gzip
    CODE

After the backup compression is enabled, pigz will be overlayed by the gzip RPM package reinstall or update.

Enable pigz on CloudBoot Compute Resources

To use pigz and unpigz on CloudBoot compute resources:

  1. Download these two files to your Control Panel:
     CentOS 6

    http://rpm.repo.onapp.com/utils/pigz-2.2.5-2.1.x86_64.tar.gz
    CODE

     CentOS 7

    http://rpm.repo.onapp.com/utils/pigz-2.3.3-1.el7.centos.x86_64.tar.gz
    CODE
  2. Distribute the files to your CloudBoot compute resources with scp to the /tmp/ folder:

    scp /root/pigz-2.2.5-2.1.x86_64.tar.gz root@192.168.1.31:/tmp/
    CODE
  3. Log in to the compute resource with ssh:

    cd /tmp/;tar xzvpf pigz-2.2.5-2.1.x86_64.tar.gz -C /
    CODE
  4.  Make a copy by renaming gzip to gzip.bin:

    mv /usr/bin/gzip /usr/bin/gzip.bin
    CODE
  5. Create a link pointing to pigz:

    ln -s /bin/pigz /usr/bin/gzip
    CODE
  6. Make a copy by renaming unzip to unzip.bin:

    mv /usr/bin/unzip /usr/bin/unzip.bin
    CODE
  7. Create a link pointing to unpigz:

    ln -s /bin/unpigz /usr/bin/unzip
    CODE