Skip to content
Brian D. Burns edited this page Dec 13, 2011 · 11 revisions

Compressors

Currently supported compressors:

  • Gzip
  • Bzip2
  • Lzma
  • Pbzip2

Examples

The following examples should be placed in your Backup configuration file.

Backup::Model.new(:my_backup, 'My Backup') do
  # examples go here...
end

Gzip

compress_with Gzip do |compression|
  compression.best = true
  compression.fast = false
end

This will compress your backup files using Gzip (best compression, rather than fast). This requires you to have the Gzip utility installed on your machine.

Bzip2

compress_with Bzip2 do |compression|
  compression.best = true
  compression.fast = false
end

This will compress your backup files using Bzip2 (best compression, rather than fast). This requires you to have the Bzip2 utility installed on your machine.

Lzma

compress_with Lzma do |compression|
  compression.best = true
  compression.fast = false
end

This will compress your backup files using Lzma (best compression, rather than fast). This requires you to have the Lzma utility installed on your machine.

Pbzip2

compress_with Pbzip2 do |compression|
  compression.best = true
  compression.fast = false
end

This will compress your backup files using Pbzip2 (best compression, rather than fast). Pbzip2 by default will auto detect cpu count and use all for compression. It can be changed with processors option. This requires you to have the Pbzip2 utility installed on your machine.

Default Configuration for each compressor

If you are planning to compress multiple backups and usually want to use the same options (best compression, rather than fast). Then you can set the default Gzip compression to best like so:

Backup::Configuration::Compressor::Gzip.defaults do |compression|
  compression.best = true
end

So now, every time you wish to compress a backup with Gzip in best compression mode, all you have to add to your configuration file is the following:

compress_with Gzip

and you won't have to specify compression.best = true since it is now the default option, unless overwritten within the compress_with block.

Clone this wiki locally