Post-Install: Performance
Performance options inside the Customizable post-install script. Currently this category contains a single optimization: replacing gzip with pigz so backups and compression use every CPU core instead of one.
What this category covers
Use pigz for faster gzip compression
Standard gzip compresses data using a single CPU core. On modern Proxmox hosts with 8, 16 or 32 cores, that is a huge bottleneck during vzdump VM/CT backups, log rotation, and anything else that pipes through gzip. pigz is a drop-in parallel replacement: same gzip-compatible output, but it spreads the work across every core.
What ProxMenux does
Five steps, all idempotent:
- Sets
pigz: 1in/etc/vzdump.confso Proxmox's backup tool uses pigz natively. - Installs the
pigzapt package if not already present. - Writes a wrapper script at
/bin/pigzwrapperthat forwards every argument to/usr/bin/pigz. - Registers a dpkg diversion for the system's
gzipbinary (/usr/bin/gzipon Proxmox VE 9,/bin/gzipon Proxmox VE 8): the real binary is kept beside it asgzip.distriband the wrapper takes its place. From now on, anything that callsgzip— logrotate,tar czf, scripts, vzdump — uses pigz transparently. - Checks that the file kept as
gzip.distribis a working gzip before the wrapper is put in place, and reinstalls thegzippackage first when it is not. A host that still has the earlier/bin/gzip.originalswap is moved to the diversion when the option is applied again.
# What ProxMenux runs under the hood
sed -i "s/#pigz:.*/pigz: 1/" /etc/vzdump.conf
apt-get -y install pigz
# The wrapper pins PATH so gzip resolves inside the script even under sudo,
# and sets GZIP="-1" — fastest compression level, lowest ratio. The trade
# is intentional: on multi-core hosts wall-clock time drops far more than
# the archive grows.
cat > /bin/pigzwrapper <<'EOF'
#!/bin/sh
PATH=/bin:$PATH
export GZIP="-1"
exec /usr/bin/pigz "$@"
EOF
chmod +x /bin/pigzwrapper
# gzip is diverted: the real binary is kept as gzip.distrib, package updates
# land there, and the wrapper takes the place of gzip.
# Path on Proxmox VE 9; on Proxmox VE 8 it is /bin/gzip.
cp -p /usr/bin/gzip /usr/bin/gzip.distrib
dpkg-divert --local --no-rename --divert /usr/bin/gzip.distrib --add /usr/bin/gzip
cat /bin/pigzwrapper > /usr/bin/gzipThis replaces a system binary
gzip is unusual. It is safe (the wrapper produces gzip-compatible output), but worth knowing: scripts that hardcode paths, run inside restrictive chroots, or verify binary hashes may behave differently. The real binary is preserved as gzip.distrib, and because the replacement is a dpkg diversion, an update of the gzip package — or the upgrade from Proxmox VE 8 to 9 — updates that file and leaves the wrapper in place.Reversible from the Uninstall menu
gzip.distrib back over the wrapper, removes the diversion and the pigzwrapper, comments out the pigz line in /etc/vzdump.conf, and runs apt purge pigz once gzip is verified to work. Manual equivalent on Proxmox VE 9:# Manual rollback of pigz
cat /usr/bin/gzip.distrib > /usr/bin/gzip # restore the real binary
dpkg-divert --local --no-rename --remove /usr/bin/gzip
rm /usr/bin/gzip.distrib /bin/pigzwrapper
sed -i 's/^pigz: 1/#pigz: 1/' /etc/vzdump.conf
# Optional: remove the package
apt purge pigzVerification
After applying, gzip --version should mention pigz. A quick benchmark also shows the speed difference on a multi-core host:
# Confirm gzip now points to pigz
gzip --version
# Expected first line: "pigz 2.x … by Mark Adler"
# Compare throughput (create a 1GB file of random data and compress it)
dd if=/dev/urandom of=/tmp/test.bin bs=1M count=1024 status=none
time gzip -k /tmp/test.bin # uses pigz — parallel
rm /tmp/test.bin.gz
time /bin/gzip.original -k /tmp/test.bin # original single-threaded gzip
rm /tmp/test.bin /tmp/test.bin.gzWhen this matters most
Related
- Backup and Restore commands — vzdump CLI reference, including
--pigzthreads option. - Storage — vzdump speed limits and ZFS ARC tuning.
- System — file-descriptor and memory tuning.
- Customizable Post-Install — back to the parent menu.