Open main menu

Changes

3,787 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:
<ul ol style="list-style-type : upper-roman;">
<li><strong>Operational</strong>: Routine (e.g. daily) backups - especially in a networked multi-user environment for operational resiliency and efficiency</li>
<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]]</ulol>
== Example Use Cases ==
<ul ol style="list-style-type : upper-roman;">
<li> I accidentally deleted a file, and I want to get it back (without having to call Tech Services) and if I can't get my file back, I want to blame tech services</li>
<li> I want to make an online (meaning network accessible) archive of my old machine before I wipe it completely to turn it into a Media Center PC (Using Mythbuntu or LinuxMCE)</li>
<li> I want to making a full system backup of my notebook before I do a distribution upgrade from Kubuntu 8.4 to Kubuntu 8.10 -- just in case the upgrade doesn't go smoothly so that I can revert and start again, or revert and work on resolving blockers.</li>
</ulol>
Given the different goals of what one might mean by the term "backup", there are naturally different solutions that work best in each scenario. If you are a technical user, you must get familiar with [http://samba.anu.edu.au/rsync RSync]. Even when you need to employ other systems or tools, RSync is the swiss army knife of backups.
=== Resources ===
# [[wp:Category:Free_backup_software]] The most interesting are## http://en.wikipedia.org/wiki/BackupPC## http://en.wikipedia.org/wiki/Bacula (which is mostly comparable to Amanda - but uses a non-standard albeit open format)## http://en.wikipedia.org/wiki/FlyBack which is a nice UI on rsync and aims to mimick the Mac TimeMachine## You're familiar with http://en.wikipedia.org/wiki/Rsync by now right?# [http://linux.com/features/150600 TimeVault simplifies data backup for Ubuntu]TimeVault is only beta at this point.
== File Backups ==
</source>
shows you what file system types are supported under your currently running kernel
 
So if you've identified the disks you want to backup, and mounted them, you also need to be aware of the parts you DO NOT want to backup. On a Linux system, the list of EXCLUSIONS would include
* /proc/
* /tmp/
* /sys/
 
<source lang="bash">
sudo rsync -ravlHz --progress --stats --exclude=/mnt/usbdrive/* --exclude=tmp*** --exclude=/proc/** --exclude=/sys/** --cvs-exclude --dry-run / /mnt/usbdrive/backups/liberty
</source>
I added the --dry-run option in there because you should always test first, and because I do not want anyone blindly copy and pasting this command without testing and tweaking it.
== System Image aka Backups for Disaster Recovery ==
So, when it came to using a backup program, I chose [http://www.mondorescue.org/index.html Mondo Rescue] because it can backup to CD, DVD, disk (e.g. external USB drive) or other mediums like tape drives. Plus, it can create a restore disk for you which is what I want... in the case of catastrophic system failure, I want to be able to [[cloning|recreate my computer on new hardware]].
I have an external USB hard drive with a terabyte of storage that I have mounted at /media/disk
"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 ==
Backing up ~94 GB with MondoRescue to image files with medium compression could still generate around 20 4GB DVD images. That is a lot of data and will take a significant amount of time.
 
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