| 1)Small Scale Back- ups and Restoring a. MBR backup and restore. b. the cp command. 2)Medium Scale Back- ups a. GUI method of backing up. b. GUI restoring general data. a. Firefox Bookmarks Restoring (GUI method) b. Evolution Restoring (GUI method) c. Firefox Bookmarks Back up and restoring (Firefox Method) d. Evolution Back-ups, Terminal commands method. e. Evolution Restoring, with Terminal commands f. Make a backup script to run your backup commands automatically g. Configure 'crontab' to run your backup script regularly at the times you set h. Make a restore script i. Back-up and Restore Added Software 3) Whole Partition Back-up and Restore a. Complete Back-up Using File Compression b. GParted Partition Back-up. |
| sudo dd if=/dev/sda of=/home/ubuntu/080525MBR.img bs=446 count=1 |
| 1+0 records in 1+0 records out 446 bytes copied, 4.3e-05 seconds, 10.4 MB/s |
| Warning: You can make a backup copy of your MBR with the entire 512 bytes, which includes the entire MBR meaning the partition table and 55 aa signature. That may be useful for some purposes, but be sure you destroy that copy of your MBR if you decide to re-partition your disk later. If you accidentally restore your MBR backup with an out of date partition table, it will not match your new filesystems. It will cause your disk to be unreadable. Unless it is very important data you will probably have to give it up and reformat and repartition your disk and loose all your data and have to start again. If you only want the to make a backup copy of the bootloader code, you only need the first 466 bytes of the MBR, so it will not include the partition table. That is much safer. That is what I do, and what is shown here. |
| sudo dd if=/home/ubuntu/080525MBR.img of=/dev/sda bs=446 count=1 |
| cp myblog myblog_backup |
| cp myblog_backup myblog |
| sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup |
| sudo cp /boot/grub/menu.lst_backup /boot/grub/menu.lst |
| ls /boot/grub/ |
| cp -r .evolution/addressbook 07jan06bak cp -r .evolution/calendar 07jan06bak cp -r .evolution/mail 07jan06bak cp -r .evolution/memos 07jan06bak cp -r .evolution/tasks 07jan06bak |
| cp -r 07jan06bak/addressbook .evolution cp -r 07jan06bak/calendar .evolution cp -r 07jan06bak/mail .evolution cp -r 07jan06bak/memos .evolution cp -r 07jan06bak/tasks .evolution |
|
Make a backup script (and a restore script) to make your backups automatically Making a backup script A script is a text file that has been given a name that ends with the extension .sh (short for 'shell', since they're really supposed to be called 'shell scripts', most most people just call them scripts. A shell script contains a list of commands. They are the same as the commands you would type in a terminal normally, but this way you can run a whole list of commands in one hit. If you type: introduction to shell scripting (or something like that) into google you will have pages and pages of helpful tutorials. My favorite one is from Rute User's Tutorial and Exposition, and the exact chapter is: 7. Shell Scripting If you want to really learn shell scripting, it would be best to refer to a proper tutorial like Rute's where everything is explained a lot better than in this page. 1. Make a directory in your /home/username folder and call it: all_backups you could also call it any other name you like, any_backups or acer_backups, (I have a habit of making up names beginning with the letter 'a' for my most important directories and files so I can find them faster). One requirement for shell script is shell scripts need to have #!/bin/sh at the top. Another requirement is it has to be given file permissions that mark it as being executable. 2. Create a new empty file in the all_backups directory called: evo_bak.sh (or something similar).
3 (a) type in the following commands: rm -rf all_backups/daily_evobkup mkdir all_backups/daily_evobkup cp -r .evolution/addressbook /all_backups/daily_evobkup/ cp -r .evolution/calendar /all_backups/daily_evobkup/ cp -r .evolution/mail /all_backups/daily_evobkup/ cp -r .evolution/memos /all_backups/daily_evobkup/ cp -r .evolution/tasks /all_backups/daily_evobkup/ for example,
3 (b) Take a look at the file permissions of the new evo_bak.sh file with: ls -l all_backups
For the script to work it must have permission to be executed. We can fix that with a chmod command,
We can test our script to make sure it works by typing the path and name of the script in out terminal, like this,
Inside that will be a backup of our evolution addressbook, calendar, mail and tasks folders. If you want to keep (preserve) this particular backup, you must rename it. I suggest renaming it something like: 14april2007.bak (or something like that, it's a good idea to include the date in it ). I'm just deleting mine for now, because in a few minutes I'll be making a new one to test the crontab command to make sure it works, so I'll be making another backup then too. Use 'crontab' to make your automatic backups happen automatically. This method means you will be able to make an up to date backup CD-ROM very easily at any time. It is very convenient to be able to just grab your evolution files quickly and easily when you want to copy them to a CD-ROM. With this method you are always ready. The Official Ubuntu Wiki has a good page on cron, CronHowto, you should also read that if you want to learn to use crontab. The crontab command has three options,
to list your current crontab
To see if the cron daemon is already running,
The -r option causes the current crontab to be removed. will remove (i.e. delete) your current crontab.
This will have removed my old crontab, to take a peek and make sure I'll do crontab -l again,"Don't try this at home, folks", this is just a demonstration, you should be careful not to remove anything that might be important.
This method uses a text editor like vi or joe or nano to edit /var/spool/cron/crontabs files in the computer. When you exit the editor, the new crontab file will be installed automatically. The files in /var/spool/cron/crontabs should only be edited via the crontab command. crontab -e is used to edit the current /var/spool/cron/crontabs/crontab using the editor specified by the VISUAL or EDITOR environment variables.
You will see a file open in your text editor, usually nano by default, (mine's nano anyway), and the file has a commented line like this (below).
'm' column is for minutes, you can type any number here from 0 to 59, an * means every minute. 'h' column is for hours, you can type any number here from 0 to 23, or * for 'every'. 'dom' column is for 'day of the month' from 1 to 31, or * for 'every'. 'mon' column is for 'month of the year'use a number 1 to 12 or type 'march', or * for 'any'. 'dow' column is for 'day of the week', mon=1, tues=2, wed=3, thu=4, fri=5, sat=6, sun=7 Note: with this method there is no column for 'user' because the file itself is already user-specific. More information to be added here soon, website under construction.
To see if the cron daemon now running again,
Now all you need to do is keep an eye out for your new evodaily backup to appear in your /home/username/all_backups directory. It will be automatically updated every day at the same time as long as you leave the cronjob running. Email can occupy large amounts of hard disk space. Keeping a back up of all your email all the time like this doubles the amount of disk space used for your email. If you are short of disk space you may need to disable this cron job temporarily. # Placing a hash mark in front of the line in crontab will disable the operation if you want to stop it for a while. If you want to save a backup from any particular day, just rename the folder. You can name it anything you like, but I suggest making up a name that includes the date of the backup in it. For example: 14apr07_evolutionbackup The main purpose of this is to make it quick and simple to copy these backups to a CD-ROM once in a while. You should copy them when you are sure you have them safely copied to CD-ROM, only then delete them to recover your hard disk space. Make a restore script You can restore everything separately with a series of commands or you can make a matching restore script, let's call it: evo_rest.sh
Apply the chmod command again to enable the new shell script to be executed and check with ls -l that the file permissions are right.
Or, try right-clicking on the script and click 'Open', then 'Run in Terminal'. The script will instantly overwrite your evolution files with whatever is in the backup. If you want to restore to an earlier date, copy your present daily_evobkup folder and rename it with today's date in the name to preserve your current files. Then just find a folder with the date you need in your all_backups folder and rename that folder: daily_evobkup ...that will overwrite your current daily_evobkup folder and all its files. Then run the restore script. That will restore your evolution to an earlier time. |
| sudo dpkg -i cairo-clock_0.3.2-0ubuntu1_i386.deb |