LinuxGSM
LinuxGSM copied to clipboard
[FEATURE] Multithreaded Backups
User Story
As a server admin, I would like backups to be multithreaded so that they finish in a timely manner.
Basic info
- Distro: [Ubuntu 22.04.1]
- Game: [Valheim], [ProjectZomboid], [DayZ], [Minecraft], [Starbound]
- Command: [Backup]
- LinuxGSM version: [v22.1.0]
Further Information
As part of the install configuration, can you check if pigz is installed? The current command_backup.sh script uses the gzip option with tar, which is single threaded. On my server it makes backups take several minutes for only a few GB.
tar offers the option: --use-compress-program, which you can then reference pigz there.
Here is the current single threaded code from command_backup.sp, Line 142:
tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}/backup.lock" ./.
By removing the z from -czf, and adding the --use-compress-program, the updated code becomes:
tar --use-compress-program="pigz -k " -cf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}/backup.lock" ./.
I've updated the command_backup.sh for all of my game servers to reflect this change, and my backups now only take 20-40 seconds instead of 4 or 5 minutes.
It would be a very nice quality of life feature if LGSM would check for pigz, and use this multithreaded option when it is available.
Further Reading
https://stackoverflow.com/questions/36917882/how-to-use-pigz-with-tar https://www.maketecheasier.com/compress-files-faster-with-pigz/