Emmabuntus, Ubuntu, Derivate, Linux, Open Source BackTrack, Linux, distributions, Ubuntu, derivate, securuty, forensic VirtualBox, Linux, Ubuntu, Raring Ringtail synaptic, Ubuntu, Linux, software packages jwplayer, multimedia, Linux, Ubuntu, flash Meshlab, graphic, software, Ubuntu, open source, Linux Synapse, Linux, Ubuntu, raring, Quantal Gimp, Ubuntu, Linux FreeMind, Linux, open source Linux, infographic, history

Simple Linux Backup is an easy-to-use backup tool to automatically back up a Linux desktop system.

This article describes a simple backup method that I use every day to backup my home Linux systems.

It's an easy method that non-technical Linux users can use to backup their important data. We'll discuss the decisions you have to make in order to do a thorough backup.

You hear it all the time from writers and your geek friends: "You should backup your computers." Well, here's one more geek to bug you about it again, but also to give some help.

One of the main strengths of my backup method is that it's simple, easy to set up and use, and can be completely automated. Since I use this method to backup my home systems, the method as well as the main backup programs presented here have been tested in my environment for a couple of years.

WordLinx - Low Cost Traffic

screenshot

This backup method can be performed manually, but is better automated. I'll give you a couple of small programs that I've written to help automate this backup method, along with step-by-step instructions to use the software. We'll also briefly look at a couple of other good programs to help you backup.

What does it mean to backup something? It simply means making a copy of that something for safekeeping, in case the original becomes unusable. The copy should be stored on different hardware than the original -- for example, you might copy a document in your Documents folder (which is on your hard drive) to a USB key, a CD, or even an on-line service.



Full 2


Why and what to backup

Why should you bother making backups? Because computers fail: hard drives fail, making it impossible to get your data from them; systems and software crash, sometimes corrupting or deleting your important documents. And people fail too: have you ever accidentally erased a file that you needed? I've done it too many times. With a backup, you're mostly protected: only the very latest changes, if any, are lost when you restore a backed-up file.

What should you backup? Your priority should be to backup those files that are most important and hardest to recreate. Here's my take on the importance of backing up certain data from the perspective of a general desktop user, from most important to least:

  1. Your files -- This includes documents, spreadsheets, email, calendar data, financial data, downloaded music -- anything that you've created, recorded or received that has meaning and importance to you. These are clearly the most important and hardest to recreate, because you or others created them from imagination and hard work or because you paid for them.
  2. Your settings -- This includes changes you've made to personal settings: desktop configuration (e.g., colors, backgrounds, screen resolution, mouse settings, locale) and program options, such as settings for OpenOffice, Gimp, your music player, and your email program. These are easier to recreate than your documents, but you'd hate to lose them -- it takes time to recreate them.
  3. System settings -- Many people never touch their system settings -- the settings are created during Linux installation and stay that way. For those people, backing up system settings is less crucial than backing up their personal settings, since a re-installation would fix things. For people who customize their systems -- e.g., changing system configuration files in /etc -- backing up these settings can be at least as important as backing up personal settings.
  4. Installed software (and everything else) -- This category includes installed system software (primarily Linux) and application software (such as OpenOffice, Firefox, and the Apache Web server). Such software can usually be restored by reinstalling, but not always.



Scarica subito!

The data

The method presented here is best suited for backing up the high-priority items -- your files, your settings, and possibly system settings. And the amount of data you can backup is limited to the size of whatever you're backing up to; we'll discuss this further below.

The backup schedule

Backups are done once every day in a weekly cycle. On Mondays, the backup program performs a full backup -- it backs up everything you've asked it to. On other days, it does an incremental backup -- it only backs up files that have changed since the last backup. The program keeps all the backups for that week -- that is, it keeps the Monday full backup along with the Tuesday through Sunday incremental backups. That way, you can always restore any file that's been backed up on any day of the week. When Monday comes around again, last week's Monday backup is erased to make room for the new Monday full backup.

Automatic or manual

The backups can be started automatically by your system at certain times of the day. We'll discuss how to use the Linux scheduler tool, known as cron, to do this. Or you can manually start a backup, preferably at the end of the day after you're done using the computer.

Backup to what?

You have a lot of options when choosing what kind of device will receive the backup. Consider factors such as:

  • Portability -- Do you need to use the device to backup several machines? Will the backup media (such as diskettes, an external hard drive or Iomega Zip disks) be carried off-site?
  • Capacity -- How much data will be backed up? Remember that the media must hold up to a week's worth of backup data with this backup method. Do you want to use multiple removable media, such as a set of Zip disks? If so, the backups can be spread among those media, so each one doesn't have to hold the full week's data -- but you'll need more disks, which raises the cost.
  • Speed -- Some types of devices are much faster than others and can backup much more data very quickly. For example, copying data to a USB key or an external hard drive can be very fast, much faster than a Zip disk or diskette.
  • Cost -- Larger or more flexible media usually cost more.






One very important consideration when choosing the backup medium is capacity -- how much you need to backup. With this simple backup method, the backup size for any single backup is limited to the size of your backup medium. For example, you can backup to diskette or Zip disk -- but only one diskette or Zip disk. You won't be prompted for more when the first fills up. Of course, you can use another diskette or Zip disk for the next night's backup.

Better, you can backup to a USB memory key -- again, only one. Best: you can backup to another hard drive, such as an internal drive, an externally-attached USB drive or one elsewhere on your network. This would allow for a complete system backup -- a backup of every file on your system -- if you so choose.

This simple backup method only works for read/write drives. That is, it will backup to any drive that you can copy a file to -- a hard drive, network drive, single diskette and single Zip disk. It will not backup to a CD or DVD; you can't do a cp (copy) command to copy a file to those. Maybe I'll add that capability in Release 2 (currently scheduled for around Feb. 2019, so don't hold your breath :-). Of course, you can manually burn the resulting backup archive files to a CD or DVD.

Setting up the backup

Setting up your system for backup involves the following steps, which we'll go through in detail:

  1. Decide what to backup and what not to backup
  2. Decide the backup medium -- that is, to what device are you backing up?
  3. Determine which user will run the backup
  4. Decide if you want the backup to run automatically, and if so, add a scheduled backup task

While you have to make these decisions yourself, the provided software can help implement those decisions. Look at the Simple Backup Software page at SourceForge to get the software prepared.

Now let's look at each step in turn.



Host Unlimited Domains on 1 Account

Tip: To see how to use the Simple Backup Configuration Program for defining what to backup and what not to backup, see Defining What to Backup.

Decide what to backup

Deciding what to backup and then finding where it's all stored is probably the hardest step in setting up a backup. Files and settings are stored in many directories, along with other data that you probably don't want backed up.

We defined four categories of data above that can be backed up. Let's look at each in more detail.

  1. Your files -- These are usually stored under users' home directories, such as /home/steve. They could be in a variety of subdirectories, such as Documents or My_Documents, under the home directory. If you're backing up your entire system as the root user, don't forget to backup these items in everyone's home directory, including /root. In fact, if your users' home directories aren't too large or your backup medium has sufficient space, consider backing up all of /home.

    If you can't backup all of /home, examine Table 1 below, which lists some subdirectories (of a user's home directory) to check for important files. When looking at this table, please remember two things: first, remember that in Linux, "~/" represents your home directory, e.g. "/home/steve"; and second, remember that any file or directory name that starts with a period (".") is by default hidden. To view these in both KDE's Konqueror file manager and Gnome's Nautilus, select View from the main menu, then select "Show Hidden Files." From a command line, type ls -a from within the appropriate directory to see all files.

    Table 1 -- Directories to check for important data to backup



Dotster $14.95 Domain Name Registration

  1. Application or document type Directories What it contains
    Documents ~/Documents, ~/My Documents, ~/Desktop, ~/, others Usually contains documents you actively created, such as word processing and spreadsheet files. If you store documents on your desktop or in folders on your desktop, look in the ~/Desktop directory. Also, check your home directory for any important documents.
    Scripts and programs ~/bin If you've written any scripts or small programs, you might have put them in this directory. Otherwise this directory might not exist.
    KMail (email) ~/.kde/share/apps/kmail These directories contain your stored emails and their attachments. For Evolution, the directory stores address, calendar and to-do data as well. The Thunderbird directory also contains address data.
    Evolution (email, contacts, addresses, calendar, to-do) ~/.evolution
    Thunderbird (email) ~/.thunderbird
    Gnucash (financial)
    Any
    When Gnucash and KMyMoney first create data files, they ask where to save the files.
    KMyMoney (financial)
    KOrganizer
    (calendar/to-do)
    ~/.kde/share/apps/korganizer These directories contain calendar files with your appointments, meetings and holidays, and to-do list items.
    Sunbird (calendar/to-do) ~/.mozilla/sunbird
    KAddressBook (contacts) ~/.kde/share/apps/kabc Contains address book and distribution list files.
    KNotes (sticky notes) ~/.kde/share/apps/knotes Contains notes and configuration data.
  2. Your settings -- Your desktop environment and most applications save their settings in one or more text files. Most of these are in hidden files and directories in your home directory. For example, KDE stores its settings in the ~/.kde directory. Many KDE applications store their settings under this directory as well. We will treat bookmarks (for both browsers and file managers) as part of your settings rather than your data, so they'll get consideration here as well.

    You should examine these hidden files and directories to see which you need to backup. Consider backing up the files and directories listed in Table 2 below, all of which would be in your home directory if they exist. Note that this list is undoubtedly far from complete; if you use different applications than I use, your list could be very different. Note that the asterisks ("*") in the list below indicate that anything can follow; for example, ".gimp*" would include ".gimp" as well as ".gimp-2.2".

    Table 2: Files and directories to check for personal settings



  1. uBid is the marketplace you can trust!

    .bashrc, .bash_profile (if you've customized them) .eclipse .emacs .fonts.conf
    .gaim .gconf .gconfd .gimp*
    .gnome .gnome2 .gnucash .gnupg
    .gtk-bookmarks .kde .local .lpoptions
    .mozilla (has settings for Mozilla, Firefox, and Sunbird) .mplayer .ooo*, .OpenOffice*, .openoffice*, or OpenOffice* .profile (if you've customized it)
    .realplayerrc .spamassassin .ssh .viminfo
    .Xauthority .xemacs .xine .xinitrc
    .Xmodmap

    As mentioned above, don't forget to backup these items in every user's home directory under /home, and in root's home directory in /root.

    You may not want to backup everything in each of these directories. For example, several applications improve their performance by caching data in special directories. My Firefox cache directory at ~/.mozilla/firefox/xxxxxxxx.default/Cache has about 30 megabytes of files that I don't want backed up. You'll see later how you can add such files and directories to an exclude list to ensure they are not backed up.

  2. System settings -- Almost all system settings are stored in files in the /etc directory. I recommend backing up the entire /etc directory; it's generally not exceedingly large (on my systems, it's less than 60 megabytes), and it can be hard to distinguish between what's important and what's not. Note that you'll be able to backup everything in /etc only if you run the backup as the root user. Otherwise, certain files and directories may not be accessible during the backup.

    The /var directory may also contain some important data, but don't backup all of it. For example, on my SUSE Linux 10.0 system, /var contains several large cache directories that I do not backup, but also contains /var/spool/mail (user mail files) and /var/spool/cron (settings for cron), which I do backup.

    You should consider backing up the /boot directory as well. This contains the system boot configuration, including the compressed Linux kernels, configuration data, and data for the GRUB boot loader (which lets you select an operating system when booting). Personally, I don't backup this data because it's not hard to restore. You may want to consider backing it up if you dislike reloading and reconfiguring software.

    If you've made changes elsewhere in the system, consider backing up those files as well. For example, I often add scripts or links to /usr/bin or /usr/local/bin, and I add just those files to the backup. Perhaps you've added fonts under /usr/X11R6 or scripts in /bin -- you can add those files or directories to the backup as well.

  3. Installed software and everything else -- For most desktop Linux users, installed software and software configuration files can be restored by reinstalling the system or the missing software, and thus there is little chance of permanently losing something. However, if you sometimes install software that you've purchased and downloaded from the Internet, you may want to consider backing up those applications separately; if your hard drive fails, you may not be able to download the software again. Also, reinstalling software or system drivers is not a whole lot of fun, even for geeks like me, so it may be worth your while to backup such software.


uBid is the marketplace you can trust!

After this detailed examination of what to backup, there is one more consideration that could make the whole discussion moot. If you have a sufficiently large and fast backup medium and enough time, why not just backup the entire system? In other words, just specify the root directory "/" as the one directory to backup. (If you do this, you probably want to exclude network-mounted file systems -- it's usually faster and safer to back them up directly rather than indirectly across a network.)

The backup medium -- Backup to what?

Tip: To see how to use the Simple Backup Configuration Program for defining the backup medium and directories, see Where to backup.

As described above, the backup medium for this method can be any device that can have files copied to it. It works very well with USB memory or hard drive devices, network-attached drives, floppy disks, and Iomega Zip disks. For removable storage like USB memory and hard drives, all you have to know is where to find the device's files when it's plugged in to your system -- that is, where it is mounted.

Most modern Linux systems mount devices automatically when they are plugged in (USB, FireWire devices) or inserted (floppy or Zip disks). Most also put an icon on your desktop (SUSE Linux 10.0 puts an icon in a "My Computer" folder on your desktop). You can use these icons to find out where the device is mounted -- see "Where Is It Mounted?."

Where is it mounted?

On my SUSE systems, plug-in and removable media are mounted in the /media directory, e.g. /media/usbdisk for a USB memory device or /media/floppy for a floppy disk. To find out where your device is mounted, find the device's icon. In both KDE and Gnome, double click on the device icon to open a file manager window for the device; look at the Location Toolbar near the top of the window to find out where the device is mounted. In Gnome's Nautilus, it may help to go up one level -- use the toolbar's Up button.

Who runs the backup?

Tip: To see how to use the Simple Backup Configuration Program for restricting the backup user, see Advanced Backup Options.

Should the backup be run as the root user or as a regular user? That depends on what data you're backing up.

If you're only backing up files below your own, regular-user home directory, then running the backup under your user id should work fine. But if you're backing up system files or other users' files, this may not work -- your regular user id may not have sufficient privileges to access those files.

As an example, my backups include the entire /etc directory. However, my regular steve user id cannot access a few directories below /etc, such as /etc/ssl/private and /etc/cups/certs, and also has no access to the home directories of my wife's and kids' accounts. As a result, I run my backups as the root user.

There are other, more complex solutions to this access issue, but they're beyond the scope of this article. If you have access problems, run the backup as root.



Click here for last second holidays

Automating the Backup

Tip: Although it doesn't automate the backup for you, the Simple Backup Configuration Program can help you automate it. See Advanced Backup Options for details.

If you leave your computer on most or all of the time, you can have the backups run automatically. That way you don't have to remember to do it at the end of the day (or night, for we programmers).

We'll use the standard Linux scheduling tool called cron, a service that starts programs at scheduled times. The "schedule" it uses is called a crontab. You can change the crontab with the crontab -e command, or using a graphical tool such as KCron (part of KDE), gnome-schedule, or vcron. There are only two things you have to do:

  1. Make sure the cron service is set up -- Your Linux distribution probably has a graphical tool to let you do this; use it if it does. For example, in SUSE Linux 10.0, you would use YaST Control Center, selecting the System category, then the System Services subcategory. Mandriva Linux is similar: from Mandriva Control Center, select System, then Services. Fedora Core has the system-config-services command. Or you can use the Linux command chkconfig:
    steve-lap:~ # chkconfig
      Makefile off
      SuSEfirewall2_init on
      SuSEfirewall2_setup on
      acpid on
      alsasound on
      atd off
      autofs off
      autoyast off
      ...
      boot.scsidev off
      chargen-udp off
      cron on
      cups on

    This command shows which services are on and which are off. The list of services can be very long, so you may want to run the command as chkconfig | grep cron. If the cron service is off, run the following two commands (in bold and underlined below), which turn it on and then double-check that it's on:
    steve-lap:~ # chkconfig --set cron on
    steve-lap:~ # chkconfig | grep cron
    cron on
    steve-lap:~ #

  2. Schedule your backup -- Now, run either KCron, gnome-schedule, or vcron to schedule your backup. For KCron, type kcron from a command line to start KDE's scheduler tool (or the Simple Backup Configuration Program can start it for you). If you want to run the bkup script as a regular (non-root) user, kcron is simple: just right-click on the Tasks item and select New to open the Edit Task dialog (see Figure 1). In the Comment field, type a comment such as "Everyday system backup." In the Program field, enter the full path to the bkup script supplied with the software, followed by a space, followed by the full path of the directory to the configuration files (by default, ~/.simplebackup). Next, click the "Run every day" checkbox. Select the time -- as an example, select the "23" button under Hours and the "0" button under Minutes for 11:00pm. Finally, click the Ok button to save the new task.

no one deals like we do!


  1. Figure 1: KCron's Edit Task dialog with values filled in to run the Simple Backup script at 11:00 pm every night
    (Click image to enlarge)

    Next, right-click on "Variables" and select New. In the Edit Variable dialog, select "SHELL" for the Variable field, and for Value enter "/bin/bash". This is needed because the bkup script needs to run in Bash.

    If you want to run bkup as root, you must also run kcron as root. The screen looks more complicated (see Figure 2) because you can schedule tasks for any user; just click the + sign next to "System Crontab" or next to "root" (either will work fine), and then proceed as described above to add the task and the SHELL variable.


Figure 2: KCron's main window with a task added to run the simple backup script and a variable added to change the SHELL to /bin/bash
(Click image to enlarge)


weekly apparel banner

And that's it! Assuming you remember to leave your computer on, it should now automatically perform the backup at the time you specified.

Outputs of the Backup

After a backup has run, it's a good idea to check that everything worked as expected. In the Advanced Backup Options, you specified a directory for log files. These log files contain the outputs from the backup script's commands. Have a look to see if there are any error messages.

The bkup script stores all backed-up files in a compressed archive file. Specifically, the archive is a gzip-compressed tar archive. You can find these files, one for each day of the week, in the directory you specified in the Where to Backup page of the Simple Backup Configuration Program.

Restoring Files From the Backup




For now, restoring backed-up files is a manual process -- you can't do it using the Simple Backup Configuration Program. You must look in each archive file, from newest to oldest, to see if it contains the file that you want to restore. The process is described in the steps below; I hope to automate this in the future.

  • Plug in or insert the backup device to mount it, if necessary.
  • Find the directory containing the backup files. You specified this directory in the Where to Backup page of the Simple Backup Configuration Program.
  • Determine which is the newest archive file in the directory, using the file's date and time. In Konqueror and Nautilus, you can view the files' dates and times and sort the directory by date/time. From a command line, issue the command ls -ltr.
  • Look in the archive file to see if it contains what you want to restore:
    • In Konqueror or Nautilus, open the archive file by double-clicking on it. Konqueror will simply display the archive's contents; Nautilus by default will open Gnome's Archive Manager (File Roller). (You can also right-click on the archive in Konqueror and select the Open with Ark option to open KDE's archive manager.)
    • If you prefer the command line, you can issue a command to list all files in the archive and then grep on the name of the file you want to restore:

      steve-lap:/media/usbdisk # tar tzf Backup.Wed.tar.gz | grep bookmarks.html
      home/steve/.mozilla/firefox/xxxxxxxx.default/bookmarks.html
      steve-lap:/media/usbdisk #

  • Restore the file by using either your file manager or the command line:
    • In Konqueror or File Roller, navigate to the file that you want to restore. Open another Konqueror or Nautilus window and navigate to the directory where you want to put the restored file. Then just drag the file from the archive window (Konqueror or File Roller) and drop it in that directory.
    • To restore a file from the command line, change to the root directory ("/") and issue a tar command with the appropriate filenames:

      steve-lap:~ # cd /
      steve-lap:/ # tar xvzf /media/usbdisk/Backup.Wed.tar.gz home/steve/.mozilla/firefox/xxxxxxxx.default/bookmarks.html
      steve-lap:/ #

      Replace the two filenames listed in blue and red above with your archive filename and the name of the file that you want to restore. You can restore more than one file at a time if you wish. Note: the tar command above, including the blue and red filenames, should be entered as a single command.

    WordLinx - Get Paid To Click

    Buy 1    domain, get 1 free!


    Latest Post

    Linux Links




    WordLinx - Buy Real Visitors

    Yahoo!    Personals Canada



  • Share on Google Plus

    About Hugo Repetto

    Ubuntu is a Linux distribution that offers an operating system predominantly focused on desktop computers but also provides support for servers. Based on Debian GNU / Linux, Ubuntu focuses on ease of use, freedom in usage restriction, regular releases (every 6 months) and ease of installation.
      Blogger Comment
      Facebook Comment

    0 comments:

    Post a Comment