Open main menu

Changes

2,256 bytes added ,  15:32, 10 June 2016
no edit summary
Backups aren't worth anything unless you know how to [[restore]] from them, and you've tested the restore procedure to prove your backups are good. What's more, you'll gain that much more clarity about your backups. Sometimes, you don't have backups but you lose data and you're faced with the daunting task of restoring from corrupted media or deleted files. Either way, once disaster strikes, you'll want good information on how to [[Restore]].
 
== Types of Backups ==
There are three primary use cases or types of backups:
<li><strong>File</strong>: "Full" file system archive to online storage before re-building a host (completely reformatting disks and partitions)</li>
<li><strong>System Image</strong>: A complete operating system image to allow either [[cloning]] to new hardware, or full system restoration</li>
<li><strong>Database</strong>: See [[Mysqldump]]
</ol>
== Example Use Cases ==
"reduce your kernel's size"
if I want to create a boot floppy, but it doesn't matter if I want to use a boot ISO instead.
 
== Disk Image for re-deploying a drive/computer ==
On a more recent "backup" effort, I needed to archive off the contents of a laptop to an external USB drive that was mounted on another system. The source system was a Windows XP machine, while the target machine was running Linux. The tools I used to make the backup were <code>dd</code><ref>http://en.wikipedia.org/wiki/Dd_(Unix)</ref> and a LiveCD of the [http://linuxmint.com/ Linux Mint] distribution. By inserting the Linux Mint Live CD, and rebooting the laptop, I would have access to a bash shell that I could then run the dd tool from. Not only that, but I could use the Secure Shell to pipe the command over the network to the target machine's mounted external 1TB drive. Note that in my case, I used a private key (identity file) to authenticate my ssh session.
 
<source lang="bash">
sudo dd if=/dev/sda2 | ssh -i /home/mint/id_rsa-greg-notebook greg@192.168.1.11 "dd of=/media/disk-a/backups/sheila-laptop/acer.image.2"
 
# to "watch" the progress
watch ls -al /media/disk-a/backups/sheila-laptop/
 
# and also on Linux, a SIGINFO signal to the process id of a dd process will show you the status, and then continue.
kill -USR1 $(pidof dd)
 
# a local copy is MUCH faster than a network copy -- getting 17 MB/s instead of ~400 kB/s
sudo dd if=/dev/sda5 bs=4096 conv=noerror of=/media/disk-a/backups/sheila-laptop/acer.image.5
</source>
== Performance ==
Backup up ~60 GB of data across a USB 1 interface using rsync and -z for compression will take over 1 day. In fact it will take over 10 minutes to generate the file list. My experience was with 874,490 files.
 
Similarly, if you are backing up across a network, then you can get dramatically slower results than if the source and target are local. For example, in my most recent backup, I was able to copy 18GB over a wireless network but it took 43,712 seconds (over 12 hours). 19GB over a local USB2 interface took 1,037 seconds (17 minutes).
In most backup scenarios, the first backup is the one that takes the most time.
 
{{References}}
[[Category:Howto]]
4,558

edits