Backups tend to take up a lot of space, especially if you have a large database, such as a Koha SQL database with thousands of items and records. To save space, you can easily compress the file (or any folder) using one line on the Ubuntu Commandline.

If you don’t know how to backup, please read this article first. If you’ve already done your backup, do the following to compress your backup file or folder to the smallest possible size using 7zip. We recommend you compress using Tar first since 7z does not preserve

$ 7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on #archive.7z #file-to-be-compressed


#archive.7z is the name of the new archive you are creating. Don’t forget to put the 7z extension

#file-to-be-compressed is the name of the file or folder you want to compress. If it is in a different folder to the one you are in, include the path.

The ultra settings are explained as follows:


7z archive


lzma method


level of compression = 9 (Ultra)


number of fast bytes for LZMA = 64


dictionary size = 32 megabytes


solid archive = on

So if you want to compress a SQL file called koha-backup.sql and name it koha-backup.sql.7z you would do the following:

$ 7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on koha-backup.sql.7z  koha-backup.sql