<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://entorb.net//wiki/index.php?action=history&amp;feed=atom&amp;title=Backup</id>
	<title>Backup - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://entorb.net//wiki/index.php?action=history&amp;feed=atom&amp;title=Backup"/>
	<link rel="alternate" type="text/html" href="https://entorb.net//wiki/index.php?title=Backup&amp;action=history"/>
	<updated>2026-05-06T13:34:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://entorb.net//wiki/index.php?title=Backup&amp;diff=5162&amp;oldid=prev</id>
		<title>Torben: /* rsync */</title>
		<link rel="alternate" type="text/html" href="https://entorb.net//wiki/index.php?title=Backup&amp;diff=5162&amp;oldid=prev"/>
		<updated>2025-01-06T18:38:53Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;rsync&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Software]][[Category:Linux]][[Category:Windows]]&lt;br /&gt;
KEIN BACKUP - KEIN MITLEID&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As harddisks are known to break from time to time and re-setting up an old measurement pc is quite some pain in the ass, doing a backup onto an external USB harddisk (40-100€) might be worth thinking about...&lt;br /&gt;
&lt;br /&gt;
Basically we have to distinguish between two types of backups:&lt;br /&gt;
# Frequently changed data (your personal data)&lt;br /&gt;
# Full image of the PC (important for measurement PCs), that includes all needed drivers, libraries, etc and allows restoring of the PC in no time&lt;br /&gt;
The first one should be done very frequently (daily/weekly?), the second one once a year or whenever some greater changes to the PC are done.&lt;br /&gt;
&lt;br /&gt;
Concerning the USB harddisk I prefere small 2.5&amp;quot; ones that work without a separate power supply.&lt;br /&gt;
&lt;br /&gt;
Here I wrote a little guide that might help you. &amp;lt;br&amp;gt;&lt;br /&gt;
Happy backing up Torben (18.02.2010)&lt;br /&gt;
&lt;br /&gt;
==Backup of a single folder==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
====Directory Compare====&lt;br /&gt;
I like the free tool [http://tp.lc.ehu.es/jma/win32/dirco.html Directory Compare] and will now explain you how I use it to backup a single folder like My Documents (De: Eigene Dateien)&lt;br /&gt;
&lt;br /&gt;
* First get the tool. I prefer the .zip file version, since I see no need in installing it.&lt;br /&gt;
* Unpack the zip-file or install the tool into some folder (remember this folder!)&lt;br /&gt;
* Run the tool by starting &amp;quot;DirCmp.exe&amp;quot;&lt;br /&gt;
* Select the folder you want to backup as &amp;quot;Source&amp;quot; and the one you want to copy it to as &amp;quot;Target&amp;quot; &amp;lt;br&amp;gt;(e.g. your external harddisk/networkdrive etc, but keep in mind that the drive has to be connected using the same driveletter before stating the backup...)&lt;br /&gt;
* Click on &amp;quot;Scan&amp;quot; as a test&lt;br /&gt;
* Under &amp;quot;Options-&amp;gt;Configure-&amp;gt;Unattended mode&amp;quot; check &amp;quot;use direct API calls...&amp;quot; to prevent the tool to produce message windows&lt;br /&gt;
* Click on File-&amp;gt;Save to save this settings into a file (e.g. myBackup) that is placed in the program folder. e.g.: &amp;lt;br&amp;gt;c:\program files\Directory Compare\myBackup&lt;br /&gt;
* Leave the program&lt;br /&gt;
* Use the windows explorer to navigate to the program folder&lt;br /&gt;
* Right click on &amp;quot;DirCmp.exe&amp;quot; -&amp;gt; Create new Shortcut&lt;br /&gt;
* Rename it to something nice&lt;br /&gt;
* Right click on it -&amp;gt; properties (De: Eigenschaften)&lt;br /&gt;
* Edit the link target (De: Ziel) and append &amp;quot;myBackup.dcp /m/q&amp;quot; without the &amp;quot;&amp;lt;br&amp;gt;(/m stands for mirror=make target exactly the same as source, overwriting all changes to files done on taget)&lt;br /&gt;
* Now just create a desktop shortcut to this file and you are done&lt;br /&gt;
Keep in mind, that all changes to files in the target folder are lost and overwritten with each backup, since /m is set, see above.&lt;br /&gt;
If you want to keep an older version of the backup, just rename the folder on your external harddisk, so a new copy of all your data is created at the next backup.&lt;br /&gt;
&lt;br /&gt;
In order to increase security, I strongly advice using two different USB harddisks alternating, e.g. one for even months/weeks, one for uneven ones. The reason is, that if your PC breaks while your USB disk is connected you might loose it...&lt;br /&gt;
(This also keeps a little more history of changes)&lt;br /&gt;
&lt;br /&gt;
====Zip Folder====&lt;br /&gt;
Using [https://sourceforge.net/projects/unxutils/ UnixUtils] for Windows zip util. Should be possible using windows build-in Powershell (Compress-Archive input.txt output.zip).&lt;br /&gt;
 @echo off&lt;br /&gt;
 &lt;br /&gt;
 REM set outputfolder&lt;br /&gt;
 set BACKUPFOLDER=&amp;quot;sicher&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 REM get CurrDirName&lt;br /&gt;
 for %%I in (.) do set CurrDirName=%%~nxI&lt;br /&gt;
 &lt;br /&gt;
 REM use date and time commands to fetch a datestr in format 180830_0647&lt;br /&gt;
 REM for English Windows this has to be modified. Currently written for &lt;br /&gt;
 REM date returning &amp;#039;30.08.2018&amp;#039; and time returning &amp;#039; 6:47:36,10&amp;#039;&lt;br /&gt;
 set DATESTR=%date:~-2,2%%date:~-7,2%%date:~-10,2%_%time:~0,2%%time:~3,2%&lt;br /&gt;
 REM replace &amp;#039; &amp;#039; in hours &amp;lt;10 with 0&lt;br /&gt;
 set DATESTR=%DATESTR: =0%&lt;br /&gt;
 &lt;br /&gt;
 REM mkdir&lt;br /&gt;
 if not exist &amp;quot;%BACKUPFOLDER%&amp;quot; mkdir &amp;quot;%BACKUPFOLDER%&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 REM zipping using UnixUtils&amp;#039; zip, excluding backupfolder&lt;br /&gt;
 %UserProfile%\Documents\Progs\UnixUtils\zip.exe -9 -r &amp;quot;%BACKUPFOLDER%&amp;quot;\%CurrDirName%_%DATESTR%.zip *.* -x *%BACKUPFOLDER%\*&lt;br /&gt;
 REM -x *sicher\* =&amp;gt; exclude folder &amp;quot;sicher&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====rsync for Windows====&lt;br /&gt;
There is a port of rsync for Windows using cygwin, [https://www.heise.de/download/product/rsync-1271 download here]. &lt;br /&gt;
&lt;br /&gt;
=====Update of 2021: better use robocopy=====&lt;br /&gt;
 robocopy SOURCE TARGET /MIR /FFT /Z /R:10 /W:5 /MT:8 /log:robocopy.log /NP /NS /NC&lt;br /&gt;
 /MIR = Mirror&lt;br /&gt;
 /MT  = MultiThreading (default: 8 threads)&lt;br /&gt;
 /FFT = Assumes FAT file times (two-second precision). &lt;br /&gt;
 /Z   = Copies files in restartable mode&lt;br /&gt;
 /R   = Retries&lt;br /&gt;
 /W   = Wait time between retries&lt;br /&gt;
 /NP  = log: no progress (%)&lt;br /&gt;
 /NS  = log: no file sizes&lt;br /&gt;
 /NC  = log: no file classes&lt;br /&gt;
 /NFL = log: no file names&lt;br /&gt;
 /XD  = exclude dirs, does not allow wildcards&lt;br /&gt;
 /XF  = exclude files, allows wildcards: *.tmp&lt;br /&gt;
&lt;br /&gt;
For local Backup on USB disk you should remove the retry mechanism and use only 1 thread&lt;br /&gt;
 robocopy SOURCE TARGET /MIR /Z /R:0 /W:0 /MT:1 /log:robocopy.log /NP /NS /NC&lt;br /&gt;
&lt;br /&gt;
To move instead of backup&lt;br /&gt;
 Robocopy &amp;quot;.\source&amp;quot; &amp;quot;.\target&amp;quot; /move /e /MT:8 /R:3 /W:5 /LOG:&amp;quot;.\robocopy_move.log&amp;quot; /is /it&lt;br /&gt;
 /e include all subdirectories&lt;br /&gt;
 /is Includes the same files. Same files are identical in name, size, times, and all attributes.&lt;br /&gt;
 /it Includes “tweaked” files. Tweaked files have the same name, size, and times, but different attributes.&lt;br /&gt;
&lt;br /&gt;
=====Example 1 - mini=====&lt;br /&gt;
 @echo off&lt;br /&gt;
 set rsync=&amp;quot;E:\progs\rsync\rsync.exe&amp;quot;&lt;br /&gt;
 set source=/cygdrive/&amp;quot;D/photos/2017/&amp;quot;&lt;br /&gt;
 set target=/cygdrive/&amp;quot;E/backup/photos 2017&amp;quot;&lt;br /&gt;
 %rsync% -ahv --modify-window=2 --no-perms --no-owner --no-group --delete --delete-excluded %source% %target%&lt;br /&gt;
 rem a -&amp;gt; rlptgoD&lt;br /&gt;
 rem --modify-window=2 -&amp;gt; 3602 might help sometimes&lt;br /&gt;
 rem modify-window=2 -&amp;gt; allow for time differences of 2 sec, as for MS FAT&lt;br /&gt;
&lt;br /&gt;
=====Example 2=====&lt;br /&gt;
 @echo off&lt;br /&gt;
 set rsync=&amp;quot;C:\Users\menketrb\Documents\Progs\rsync\rsync.exe&amp;quot;&lt;br /&gt;
 set source=/cygdrive/&amp;quot;C/Users/menketrb/Documents/&amp;quot;&lt;br /&gt;
 set target=/cygdrive/&amp;quot;U/sicher/doks-KOPIE&amp;quot;&lt;br /&gt;
 set targetReal=&amp;quot;U:\sicher\doks-KOPIE&amp;quot;&lt;br /&gt;
 set exclude=--exclude=&amp;#039;My Music&amp;#039; --exclude=&amp;#039;My Pictures&amp;#039; --exclude=&amp;#039;My Videos&amp;#039;&lt;br /&gt;
&lt;br /&gt;
 REM write current date to file inside source folder&lt;br /&gt;
 set DATESTR=%date:~-2,4%%date:~-7,2%%date:~-10,2%_%time:~0,2%%time:~3,2%&lt;br /&gt;
 REM replace &amp;#039; &amp;#039; in small hours with 0&lt;br /&gt;
 set DATESTR=%DATESTR: =0%&lt;br /&gt;
 set datefile=%targetReal%\0backup-date-U-%DATESTR%.txt&lt;br /&gt;
 date /T &amp;gt;&amp;gt; %datefile%&lt;br /&gt;
 time /T &amp;gt;&amp;gt; %datefile%&lt;br /&gt;
 &lt;br /&gt;
 REM set target readonly off and on&lt;br /&gt;
 attrib -r %targetReal%\*.* /s&lt;br /&gt;
 %rsync% -ahv --modify-window=2 --no-perms --no-owner --no-group --delete --delete-excluded %source% %target%&lt;br /&gt;
 attrib +r %targetReal%\*.* /s&lt;br /&gt;
&lt;br /&gt;
=====Example 3 - keep daily, weekly and monthly backups=====&lt;br /&gt;
 @echo off&lt;br /&gt;
 &lt;br /&gt;
 set rsync=&amp;quot;C:\Users\menketrb\Documents\Progs\rsync\rsync.exe&amp;quot;&lt;br /&gt;
 set source=/cygdrive/&amp;quot;C/Users/menketrb/Documents/&amp;quot;&lt;br /&gt;
 set sourceReal=&amp;quot;C:\Users\menketrb\Documents&amp;quot;&lt;br /&gt;
 set target=/cygdrive/&amp;quot;C/Users/menketrb/sicher/doksKOPIE&amp;quot;&lt;br /&gt;
 set targetReal=&amp;quot;C:\Users\menketrb\sicher\doksKOPIE&amp;quot;&lt;br /&gt;
 set exclude=--exclude=Progs --exclude=&amp;#039;My Music&amp;#039; --exclude=&amp;#039;My Pictures&amp;#039; --exclude=&amp;#039;My Videos&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
 REM write current date to file inside source folder&lt;br /&gt;
 set DATESTR=%date:~-2,4%%date:~-7,2%%date:~-10,2%_%time:~0,2%%time:~3,2%&lt;br /&gt;
 :: replace &amp;#039; &amp;#039; in small hours with 0&lt;br /&gt;
 set DATESTR=%DATESTR: =0%&lt;br /&gt;
 set datefile=%sourceReal%\0backup-date-Lokal-%DATESTR%.txt&lt;br /&gt;
 date /T &amp;gt;&amp;gt; %datefile%&lt;br /&gt;
 time /T &amp;gt;&amp;gt; %datefile%&lt;br /&gt;
 &lt;br /&gt;
 :: get date in several formats for name of backups&lt;br /&gt;
 set monat=%date:~-7,2%&lt;br /&gt;
 &lt;br /&gt;
 :: Get DayOfWeek as number&lt;br /&gt;
 SETLOCAL enabledelayedexpansion&lt;br /&gt;
 SET /a count=0&lt;br /&gt;
 FOR /F &amp;quot;skip=1&amp;quot; %%D IN (&amp;#039;wmic path win32_localtime get DayOfWeek&amp;#039;) DO (&lt;br /&gt;
     if &amp;quot;!count!&amp;quot; GTR &amp;quot;0&amp;quot; GOTO next&lt;br /&gt;
     set dow=%%D&lt;br /&gt;
     SET /a count+=1&lt;br /&gt;
 )&lt;br /&gt;
 :: /a = arithmetisch&lt;br /&gt;
 :next&lt;br /&gt;
 &lt;br /&gt;
 :: Get WeekInMonth as number&lt;br /&gt;
 SETLOCAL enabledelayedexpansion&lt;br /&gt;
 SET /a count=0&lt;br /&gt;
 FOR /F &amp;quot;skip=1&amp;quot; %%D IN (&amp;#039;wmic path win32_localtime get WeekInMonth&amp;#039;) DO (&lt;br /&gt;
     if &amp;quot;!count!&amp;quot; GTR &amp;quot;0&amp;quot; GOTO next&lt;br /&gt;
     set wim=%%D&lt;br /&gt;
     SET /a count+=1&lt;br /&gt;
 )&lt;br /&gt;
 :: /a = arithmetisch&lt;br /&gt;
 :next&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 REM remove write protection&lt;br /&gt;
 attrib -r %targetReal%\*.* /s&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 echo =&lt;br /&gt;
 echo ======= Tagesbackup: rsync-d%dow% ========&lt;br /&gt;
 echo =&lt;br /&gt;
 %rsync% -ahv --modify-window=2 --no-perms --no-owner --no-group --delete --delete-excluded %source% %target%/rsync-d%dow%&lt;br /&gt;
 &lt;br /&gt;
 echo =&lt;br /&gt;
 echo ======= Wochenbackup: rsync-w%wim% ========&lt;br /&gt;
 echo =&lt;br /&gt;
 %rsync% -ahv --modify-window=2 --no-perms --no-owner --no-group --delete --delete-excluded %source% %target%/rsync-w%wim%&lt;br /&gt;
 &lt;br /&gt;
 echo =&lt;br /&gt;
 echo ======= Monatsbackup: rsync-m%monat% ========&lt;br /&gt;
 echo =&lt;br /&gt;
 %rsync% -ahv --modify-window=2 --no-perms --no-owner --no-group --delete --delete-excluded %source% %target%/rsync-m%monat%&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 REM set write protection&lt;br /&gt;
 attrib +r %targetReal%\*.* /s&lt;br /&gt;
 &lt;br /&gt;
 del %datefile%&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
====rsync====&lt;br /&gt;
Use the command line tool rsync e.g.:&lt;br /&gt;
 rsync dir1/*.txt dir2/&lt;br /&gt;
 # delete from target what is not in source&lt;br /&gt;
 rsync -r --delete dir1/ dir2/&lt;br /&gt;
 &lt;br /&gt;
 rsync -rvhu --delete --delete-excluded dir1 dir2&lt;br /&gt;
rsync is able to speak ssh: (z = compress during transfer)&lt;br /&gt;
 rsync -rvhuz --no-links --delete --delete-excluded dir1 user@server:dir2&lt;br /&gt;
&lt;br /&gt;
An alternative is [http://rsnapshot.org rsnapshot] [http://wiki.ubuntuusers.de/rsnapshot Gute Deutsche Anleitung] (Thanks to Philipp + Malte)&lt;br /&gt;
&lt;br /&gt;
An alternative with GUI, similar to Apple&amp;#039;s TimeMachine is [http://wiki.ubuntuusers.de/Back_In_Time Back In Time]&lt;br /&gt;
&lt;br /&gt;
====rsnapshop====&lt;br /&gt;
 sudo apt-get install rsnapshot&lt;br /&gt;
 sudo mkdir /sicher-rsnapshot&lt;br /&gt;
in /etc/rsnapshot.conf (use tab to separate key-values pairs!)&lt;br /&gt;
 # target folder&lt;br /&gt;
 snapshot_root	/sicher-rsnapshot&lt;br /&gt;
 &lt;br /&gt;
 # retain levels = how many backups to keep per level (alpha, beta, gamma, delta)&lt;br /&gt;
 # every day&lt;br /&gt;
 retain  alpha   7&lt;br /&gt;
 # every week&lt;br /&gt;
 retain  beta    4&lt;br /&gt;
 # every month&lt;br /&gt;
 retain  gamma   12&lt;br /&gt;
 # every year&lt;br /&gt;
 retain delta   5 &lt;br /&gt;
 &lt;br /&gt;
 # dirs to backup&lt;br /&gt;
 # LOCALHOST&lt;br /&gt;
 backup  /home/          localhost/&lt;br /&gt;
 backup  /etc/           localhost/&lt;br /&gt;
test configs&lt;br /&gt;
 rsnapshot configtest &lt;br /&gt;
run manually&lt;br /&gt;
 sudo rsnapshot alpha&lt;br /&gt;
run via crontab&lt;br /&gt;
 sudo crontab -e&lt;br /&gt;
 # m h  dom mon dow   command&lt;br /&gt;
 10 0 * * *      /usr/bin/rsnapshot alpha&lt;br /&gt;
 # every week on Monday&lt;br /&gt;
 20 0  * * 1     /usr/bin/rsnapshot beta&lt;br /&gt;
 # every month 1.X.&lt;br /&gt;
 30 0  1 * *     /usr/bin/rsnapshot gamma&lt;br /&gt;
 # every year 1.1.&lt;br /&gt;
 40 0  1 1 *     /usr/bin/rsnapshot delta&lt;br /&gt;
&lt;br /&gt;
==Full image of a harddisk drive==&lt;br /&gt;
I like the free tool [http://www.runtime.org/driveimage-xml.htm DriveImage XML] that be placed on a boot CD in order to do a full backup of a harddisk or partition. It can be found on some bootcds you can find in the net, like UBCD4Win or Hiren&amp;#039;s BootCD, but I prefere creating a small personal bootcd without any other tools on it. In order to do so read the next passage or skip it if you already have a suitable boot cd with DriveImage XML on it.&lt;br /&gt;
&lt;br /&gt;
===Build a Boot CD===&lt;br /&gt;
For some very strange reasons I was not able to build a working bootcd when running the tools in a virtualbox&amp;#039; WinXP. Using a &amp;quot;real&amp;quot; Windows (Vista 64 in my case) it all worked out fine...&lt;br /&gt;
* Fetch [http://www.nu2.nu/pebuilder/#download Bart&amp;#039;s PE Builder] &lt;br /&gt;
* Ensure you have a WinXP Install CD ready&lt;br /&gt;
* Install Bart&amp;#039;s PE Builder&lt;br /&gt;
* Get the [http://www.runtime.org/driveimage_xml.cab DriveImage XML plugin (.cab file)] for Bart&amp;#039;s PE Builder&lt;br /&gt;
* Insert your WinXP CD&lt;br /&gt;
* Run Bart&amp;#039;s PE Builder&lt;br /&gt;
* Tell the program where the WinXP install is located (CD Drive)&lt;br /&gt;
* Click on plugins and add the previously downloaded DriveImage XML plugin&lt;br /&gt;
* Close the plugin window&lt;br /&gt;
* Enable the creation of an iso file&lt;br /&gt;
* Start building&lt;br /&gt;
* Close the program and burn the newly created image onto a cd (not the file, but use the iso-image-mode of your burn program)&lt;br /&gt;
Instead of burning directly you might want to try you bootcd first using virtualbox...&lt;br /&gt;
&lt;br /&gt;
===Backing up===&lt;br /&gt;
* FIRST: Attach the external hard disk that you want to store the image of your pc on&lt;br /&gt;
* Boot from a bootcd that has DriveImage XML installed&lt;br /&gt;
* Start the tool DriveImage XML&lt;br /&gt;
* Do the backup and ensure that the image is stored on your external harddisk&lt;br /&gt;
* Settings: Compression = &amp;quot;Low&amp;quot; makes sense&lt;br /&gt;
&lt;br /&gt;
===Linux and dd, e.g. for SD cards (RasPi)===&lt;br /&gt;
from [https://raspberrypi.stackexchange.com/questions/311/how-do-i-backup-my-raspberry-pi]&lt;br /&gt;
 dd if=/dev/sdX of=/mnt/backup/sdX.dd bs=1M&lt;br /&gt;
 # (bs = blocksize)&lt;br /&gt;
 &lt;br /&gt;
 # with on the fly gzip compression&lt;br /&gt;
 dd if=/dev/sdX | gzip &amp;gt; /mnt/backup/sdX.dd.gz&lt;br /&gt;
 &lt;br /&gt;
 # with on the fly bzip2 compression (slower, but better compression)&lt;br /&gt;
 dd if=/dev/sdX | bzip2 &amp;gt; /mnt/backup/sdX.dd.bz2&lt;br /&gt;
 &lt;br /&gt;
 # with on the fly xz compression (slower, but better compression)&lt;br /&gt;
 dd if=/dev/sdX | xz &amp;gt; /mnt/backup/sdX.dd.xz&lt;br /&gt;
&lt;br /&gt;
Speed/size comparison for a 16GB SD card with only few GB in use (without filling empty space with zeros, see below)&lt;br /&gt;
  	time		bytes		MB/s	compression&lt;br /&gt;
 dd	00:43:07	15931539456	5.9	100.0%&lt;br /&gt;
 gzip	00:43:01	 5205027237	1.9	 32.7%&lt;br /&gt;
 bzip2	00:51:47	 5114374745	1.6	 32.1%&lt;br /&gt;
 xz	01:01:36	 4959001460	1.3	 31.1%&lt;br /&gt;
 after zero-filling of empty space:&lt;br /&gt;
 gzip	00:43:00	  711255877	2,6	  4.5%&lt;br /&gt;
&lt;br /&gt;
To improve compression you can fill empty blocks with zeros first on the device, but this takes time and causes write load on the device (maybe bad for ssds)&lt;br /&gt;
 dd if=/dev/zero of=asdf.txt ; rm asdf.txt&lt;br /&gt;
 # (assuming your current working dir is on the partition you want to fill the free space with zeros.&lt;br /&gt;
&lt;br /&gt;
To restore the backup, reverse the commands:&lt;br /&gt;
 dd if=/mnt/backup/sdX.dd of=/dev/sdX bs=1M&lt;br /&gt;
 &lt;br /&gt;
 # when compressed using gzip&lt;br /&gt;
 gzip -dc /mnt/backup/sdX.dd.gz | dd of=/dev/sdX bs=1M&lt;br /&gt;
 &lt;br /&gt;
 # when compressed using bzip2&lt;br /&gt;
 bunzip2 /mnt/backup/sdX.dd.gz | dd of=/dev/sdX bs=1M&lt;br /&gt;
 &lt;br /&gt;
 # when compressed using xz&lt;br /&gt;
 xunz /mnt/backup/sdX.dd.xz | dd of=/dev/sdX bs=1M&lt;br /&gt;
&lt;br /&gt;
==Disaster Recovery==&lt;br /&gt;
===Undelete single files===&lt;br /&gt;
To enable for recovery, make sure to write as little as possible onto the partition. In Linux unmounting is a good option.&lt;br /&gt;
I suggest using the Linux tool photorec, which scans an (unmounted!) partition (ext2/3, Fat32, NTFS, ...) for deleted files and recovers them to another partition.&lt;br /&gt;
photorec ships with testdisk, so to install in Ubuntu use&lt;br /&gt;
 sudo apt-get install testdisk&lt;br /&gt;
afterwards run&lt;br /&gt;
 sudo photorec&lt;br /&gt;
&lt;br /&gt;
===Fix partition table / recover deleted partition===&lt;br /&gt;
see [https://www.linuxquestions.org/questions/linux-general-1/how-to-recover-deleted-files-from-a-fat32-volume-in-linux-739511/ TestDisk ]&lt;br /&gt;
&lt;br /&gt;
===securely wipe / overwrite disk===&lt;br /&gt;
====Linux/MacOS====&lt;br /&gt;
prior to trashing or selling a harddisk you might want to wipe all data&lt;br /&gt;
 # fill with a zero-filled file&lt;br /&gt;
 cat /dev/zero &amp;gt; asdf.txt&lt;br /&gt;
 # or fill whole drive with zeros&lt;br /&gt;
 dd if=/dev/zero of=/dev/sdX&lt;br /&gt;
 # or more secure fill with random &lt;br /&gt;
 dd if=/dev/urandom of=asdf.txt asdf.txt&lt;br /&gt;
 # or&lt;br /&gt;
 cat /dev/urandom &amp;gt; asdf.txt&lt;br /&gt;
====Windows====&lt;br /&gt;
https://www.feyrer.de/g4u/nullfile-1.01_64bit.exe&lt;/div&gt;</summary>
		<author><name>Torben</name></author>
	</entry>
</feed>