User Tools

Site Tools


howtos:backup_a_partition_with_dd_and_gzip
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


howtos:backup_a_partition_with_dd_and_gzip [02/12/2018 21:34] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== Pre-Backup ======
  
 +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:
 +
 +<code>
 +dd if=/dev/zero of=/media/mounted-partition-to-backup/delete.me bs=8M; rm delete.me
 +</code>
 +
 +====== Backup ======
 +
 +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:
 +
 +<code>
 +
 +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
 +root@tdd-HP-ProBook-5310m:/media/disk# 
 +
 +</code>
 +
 +As you can see 2GB becomes a 268MB backup file.
 +
 +====== Restore ======
 +
 +To restore the backup simply parse the backup file like this:
 +
 +<code>
 +
 +gunzip -c HP_TOOLS.img.gz | dd of=/dev/sda4 bs=64K 
 +
 +</code>
howtos/backup_a_partition_with_dd_and_gzip.txt · Last modified: 02/12/2018 21:34 by 127.0.0.1