Pipe your dd backups through compression to save your disk and your sanity
Backup & Recovery (Rsync/Tar/Dd)
Pipe your dd backups through compression to save your disk and your sanity
🧩 The Challenge
Backing up an entire raw partition with dd usually means you end up with a massive image file that takes up way more space than the actual data inside. I once filled a backup server completely because I forgot that dd blindly copies the empty, zeroed-out sectors.
💡 The Fix
Throw a compression tool into the mix using a pipe so you don’t waste storage on empty space. It makes the transfer faster over the network, too, since you’re pushing fewer actual bytes.
dd if=/dev/sdb1 bs=64K conv=noerror,sync status=progress | gzip -c > /mnt/backups/sdb1_backup.img.gz
⚙️ Why It Works
By piping the stream through gzip, you are essentially telling the system to squash the zeroes before they hit your storage controller. The pipe keeps everything in memory and avoids creating those bloated, multi-gigabyte temporary files that haunt your partition tables.
🚀 Pro-Tip: Use bs=64K to bump your block size above the default 512 bytes, or you’ll be waiting until next Tuesday for the copy to finish.
Linux Tips & Tricks | © ngelinux.com | 7/15/2026
