Site icon New Generation Enterprise Linux

Stop your sparse files from exploding when you back them up

Backup & Recovery (Rsync/Tar/Dd)

Stop your sparse files from exploding when you back them up

đź§© The Challenge

Ever tried to rsync a database file or a virtual machine image, watched the disk usage on your backup target suddenly balloon, and wondered what the hell happened? And that 100GB file that only took 10GB on your source disk just ate 100GB on your backup. It’s a nasty surprise nobody warns you about.

đź’ˇ The Fix

Turns out, rsync has a simple flag to handle these “sparse” files correctly. It tells rsync to detect those empty blocks and recreate them as sparse on the destination, saving you massive amounts of disk space and precious bandwidth.

rsync -avHS --progress /path/to/source/sparse_file /path/to/backup/destination/

⚙️ Why It Works

That -S (or –sparse) flag is the key. It instructs rsync to handle sparse files efficiently by looking for blocks of zeros and writing those as sparse blocks on the destination filesystem, rather than actual data. This works wonders for things like VM disk images or certain database files that use sparse allocation.

🚀 Pro-Tip: This same sparse file awareness also exists in tar with its `–sparse` flag for your archive needs.

Linux Tips & Tricks | © ngelinux.com | 11/24/2026

0 0 votes
Article Rating
Exit mobile version