User Tools

Site Tools


Table of Contents


If you want to increase the gzip capability you would like to fill the non-allocated space with zeros. This is done by putting zeros into a file until the file fills up all space on the drive. Then delete the file to free up space. Now you should have “stuffed” the free space with good compression zeros:

dd if=/dev/zero of=/media/mounted-partition-to-backup/ bs=8M; rm


When I need to backup a parititon I use the dd command, so simple and so powerful. Usually a partition isn't filled out and have some free space. To avoid creating a unnecessary huge backup file I parse it through gzip:

root@tdd-HP-ProBook-5310m:/media/disk# dd if=/dev/sda4 bs=64K | gzip -c  > ./HP_TOOLS.img.gz
32688+0 records in
32688+0 records out
2142240768 bytes (2,1 GB) copied, 68,0337 s, 31,5 MB/s
root@tdd-HP-ProBook-5310m:/media/disk# ls -lh
total 268M
-rw-r--r-- 1 root root 268M 2011-04-03 15:56 HP_TOOLS.img.gz

As you can see 2GB becomes a 268MB backup file.


To restore the backup simply parse the backup file like this:

gunzip -c HP_TOOLS.img.gz | dd of=/dev/sda4 bs=64K 
howtos/backup_a_partition_with_dd_and_gzip.txt · Last modified: 02/12/2018 20:34 by