Jump to content

LuckyBackup (tutorial)

  • This topic is locked This topic is locked
1 reply to this topic

#1 OFFLINE   Hedon James

Hedon James

    Topic Cop

  • Members
  • PipPipPipPipPipPipPip
  • 755 posts

Posted 22 December 2013 - 02:41 PM

As requested in another thread, here is my attempt to write a tutorial about using LuckyBackup in order to create automated backup/synchronization jobs. LuckyBackup is a GUI frontend to the terminal command program rsync, as well as cron.  I have tried other backup programs, such as Deja Dup (Ubuntu default), RemasterSys, Clonezilla, Duplicity, Back In Time, and some others that I can't even remember anymore.  For various reasons, I found something lacking in each program until I found LuckyBackup.

LuckyBackup is the PERFECT solution for what I want a backup program to do.  I don't want an image of my hard drive, which needs to be re-imaged on a regular interval.  I want backups of INDIVIDUAL files, such that if a file disappears from my system (because my computer is sentient and sometimes does things without my knowledge or approval!) or becomes corrupted for some reason, I just want to browse my archived files and copy/paste it back.  And I don't want to waste CPU cycles by copying files that have already been copied; I only want to copy files that have CHANGED since the last time, i.e. an INCREMENTAL backup.  Have you ever deleted a file to the trash can, then promptly emptied the trash can, only to realize 100 milliseconds later that ONE of those permanent deletions should NOT have been deleted?  There are tools to assist in the recovery of that one file, but I can vouch that it is much quicker and easier to peruse a backup archive and copy/paste than to recover a permanent deletion!  I often create VirtualBox Virtual Machines and use that machine as a guinea pig to tweak away and practice command line kung-fu so that I don't bork my main box with a mistake.  But sometimes the Virtual Machine gets borked in the process!  Once again, it is quicker and easier to copy/paste an archived VM than to create that machine all over again.  And I tend to backup my music, pictures, and videos in at least two places, once on an EXT formatted device (because it's easily repaired with linux) and once on an NTFS formatted device (because they can be read by linux AND windows machines).  If any of these scenarios catch your attention, perhaps LuckyBackup is the perfect solution for you too.  Furthermore, LuckyBackup is extremely configurable with just about every option one can think of...even with a few options that I HAVEN'T thought of, yet.  I'd even say this configurability is LuckyBackup's greatest strength (for the experienced and knowledgeable user) as well as it's greatest weakness (for the un-initiated or newer user).  Put me in the latter category, but after much experimentation and tweaking, I have configured LuckyBackup to do exactly what I want my backup software to do.  If any of the above-described scenarios apply to you, I'd suggest that LuckyBackup is worthy of your consideration, and the following tutorial is how I achieved the magical sweet spot of backing up EXACTLY what I want, when I want.

For this tutorial, I am using LuckyBackup 0.4.6 on Ubuntu 12.04.3. LuckyBackup is available in the Ubuntu Software Center repos, as well as in DEB, RPM, and/or Tar files on sourceforge. I am assuming one knows how to install software on their system, using the desired format.  Once LuckyBackup is installed, click to open the program.  Once opened to the Main page, near the right hand column “task” choose “add”.

Posted Image
  • name your task, such as “Username/Task Backup”; for tutorial demonstration, I will use “Zune Music” as the name of my operation, which will backup all of my music files from my music directory to an external drive connected to a Linux computer in my basement, which hosts a WinXP virtual machine whose primary purpose is to sync music to my Microsoft Zune music player, as well as some friends who also have Zunes.

  • choose type of backup operation desired, either backup source INSIDE destination, or synchronize source & destination

  • I like to keep ALL my historic files in an archive fashion, so that if I accidentally delete a file, I can peruse my backups and retrieve the backup copy; as you delete files from your hard drive, your backup will contain files long ago removed from your hard drive (my production machine has about 350GB+/- of data, while my backup archive is over 500GB+/- and climbing!); the synchronize option creates a “mirror” that any file deleted on your hard drive will also be deleted on your backup; to me, this defeats the purpose of a backup, but sometimes a “mirror” is exactly what you're looking for (when I built my new computer, I did NOT want the entirety of my archived files on the machine, so I created a "sync" task, or "mirrored snapshot" of my old machine, then restored this to my new machine upon successful boot & updates of the new machine); choose the option that suits your purpose; for my example, I will use Backup Source inside Destination.

  • choose the SOURCE path of the directory to be backed up/synchronized; in my example, the source path is /home/jim/Music/. If you KNOW your path, type it in, alternatively, the radial button to the right of the text box will allow you to browse your local directory, entering the path into the text box for you (for a remote destination, you must KNOW the path on your remote machine and type it in manually)

  • choose the DESTINATION path where you want your backup to be stored; in my opinion, this should be a device that is physically independent of your source path, as it makes NO SENSE to store a backup in the same place as your primary. We can also choose a remote location, such as another computer or device on the network (we'll discuss this option later), but for simplicity of discussion, I'll use my personal example of backing up to external usb hard drive, which is a destination path of /media/'FreeAgent Drive'/Music/ Again, if you KNOW your path, type it in, alternatively, the radial button to the right of the text box will allow you to browse your local directory, entering the path into the text box for you (for a remote destination, you must KNOW the path on your remote machine and type it in manually)

  • Inasmuch as I prefer “backup source”, I also prefer the checkbox option “do not create extra directory”. If this option remains unchecked, LuckyBackup will create the “mother directory” a second time in the destination path, so that the absolute backup path will be: /media/'FreeAgent Drive'/music/music/mp3files. Checking this box prevents the duplication of the “mother directory”, so that the destination path looks like this: /media/'FreeAgent Drive'/music/mp3files.
Posted Image

With the type of backup chosen, the source and destination directories appropriately identified and defined, you are ready to fine tune your backup options by choosing the “advanced” button near the bottom left of the window. This will open another menu with 6 tabs of additional options, labeled Description, Exclude, Include, Remote, Command Options, & Also Execute.
  • The Description tab is simply a place to type any optional descriptive information you want to use to help you identify/remember your backup settings. I don't use it, but for my example, I might type “backup of music directory MP3 files, with DRM removed, for sync with iPod & Zune devices”

  • The Exclude tab is a place to exclude any files or directories that you do NOT want backed up/synchronized. LuckyBackup provides a default template of potential exclusions, with the option to create “User Defined” templates. I've only used the default template, excluding such files/paths as temp folders, caches, trash can, system mount folders, lost + found directories, etc... Placing your mouse cursor over the options will create a popup with a brief description of that option. In my example of “Music Backup”, none of these options are necessary. However, my “Home Directory” backup excludes ALL of these options. In my opinion, the exclusion of "system mount folders" is important, especially in conjunction with "recurse into directories" option discussed below.  System mount folders include devices mounted at /mnt and/or /media.  Remembering that we are backing up to destination /media/*, it is easy to see that if "recurse" is selected, but "system mount folder" is NOT excluded, you have potentially created a "backup loop" wherein you will create a backup of a backup of a backup....until your hard drive is full (which will be quite soon!).  I'm not sure of the instance where it would be desirable to backup system mount folders, but I exclude them for the reason cited.  As a matter of consistency, let's exclude each of these file types based on the unlikely instance of a stray non-MP3 file somehow ending up in my music directory and then getting copied to a backup/sync directory.
    Posted Image
  • The Include tab is a place to include additional files/file types. I have not used this option, as I have not found it necessary for my purposes.

  • The Remote tab is used to enable the backup/sync function to a remote machine, either as a source or a destination! We will skip over this for now, and will discuss later, as you must have performed a few steps beforehand in order to enable this function. (SEE BELOW: SSH KEY)
    Posted Image
  • The Command Options tab provides for additional considerations to be copied over in your backup/sync. Again, placing your mouse cursor over the options will create a popup with a brief description of that option. In my example of Music Backup, I choose ALL “preserve” options (i.e. time, date, permissions, symlinks, hard links, etc...), recurse into directories, and skip newer destination files. I NEVER delete files on the destination (previously discussed above) and if you choose this option in conjunction with “Backup source in destination", LuckyBackup will throw a warning error about the conflicting settings. If you want to delete files on destination, use with caution; otherwise, consider whether you should be using “sync files” rather than “backup files”. Lastly, if backing up to a FAT or NTFS formatted drive, select that checkbox, which will remove the options to preserve ownership, times, & permissions. Neither FAT nor NTFS recognize these conventions and failure to check this box will throw a warning error.
    Posted Image
  • The Also Execute tab provides for additional tasks to be performed subsequent to a successful or failed backup/sync. I have not used this function.
With all of your checkboxes and selections made, you can view the command line terminal entry that would be utilized in order to execute the selections you just made within the LuckyBackup GUI.  Command Line junkies profess that the CLI/terminal is usually the best option, or the easiest way to accomplish tasks.  I'd tend to agree for simple tasks, as it's a lot easier and quicker to pull up a terminal with <ctrl> <alt> <t> and type 'sudo apt-get update && install'  than to click through multiple layers of GUI to get to the Update Manager.  Conversely, I respectfully disagree with this technique when the terminal command has this many potential switches, flags, and/or options...all of which exponentially increase the chances of a typographical error.  Based on my example of Music Backup, being backed up to remote host InspironStudio, my corresponding terminal command (in all it's glory!) is as follows (who wants to type this?!!!):

Posted Image

At this point, with all desired options selected, click OK and let us perform a dry run, with no actual disk writing taking place. Near the top window bar, is a 'Run' button, with a checkbox immediately to the left labeled 'dry'. Put a check in the 'dry' box and then click 'Run'. LuckyBackup will simulate the backup/sync options you have chosen. If all goes well, no errors or warnings will be identified. If you receive error/warnings, use the warning to identify which checkbox options may be the culprit(s). When initially setting up a backup task, I recommend tinkering with different options and trying a 'dry run' until you find the combination you're looking to accomplish. Once you are satisfied with your selection, and no warnings are provided, remove the 'dry' checkbox and you can perform your first REAL backup!  (In the screenshot below, the error being shown is simply that the InspironStudio host computer is not on; turning that machine on renders a successful dry run with no errors, indicating we are ready to go!)  Inasmuch as LuckyBackup is a GUI frontend for rsync, your first backup/sync could take a very long time, depending on your selected settings and/or how much data you're backing up/syncing. On the first run, rsync will copy over EVERY file you have specified. Subsequent runs will be MUCH quicker, as rsync is an incremental program that will only copy files that have CHANGED!

Posted Image

Finally, let's automate this to perform our backup/sync on a regular basis, with no further action required of us...'set it and forget it'. Along the top bar is a black icon that resembles a stereo speaker (mousing over it reveals “schedule”). Choose this and a scheduler appears, which is a GUI for the 'cron' program. On the right hand side, 'add' a scheduled task, which reveals a detailed option window. Decide on the intervals you want to backup/sync: Daily? Weekly? Monthly? @reboot? Choose your options and click 'okay' when satisfied. Finally, click 'Cron it!' and your job is scheduled for automatic execution at the specified interval(s)!

Posted Image

Congratulations, now that you have 'set it', you can 'forget it', as your backups will happen automatically in the backgroup (or maybe while you're sleeping?!) without having to do anything else ever again! (Unless you decide to change a parameter, or create another backup task!)

SSH KEY: In order to utilize the remote backup/sync feature, you must know the name of the remote machine you want to utilize for this connection, as well as the directory path you want to utilize for backup/sync. This tab MUST compliment the Destination Path previously entered on the main window. Once a remote host is entered into the Remote tab as a destination, the Destination path will point to the Remote Host, not the local machine. Conversely, once a remote host is entered as a source, the Source path will point to the Remote Host, not the local host. While I backup my Music files to a local usb external drive, I also backup my Music directory to a remote machine in my recording studio. With the remote machine turned on, opening a terminal reveals the command prompt jim@InspironStudio:~$  Accordingly, I am user 'jim' on hostname 'InspironStudio' and I enter jim as “user” and InspironStudio as "@Host".

Next we check the ssh box, so that LuckyBackup uses secure shell as the protocol, and enter the location of the private key file that authorizes ssh to access the remote machine. However, we have not created this key yet. In order to create the key.....follow this tutorial:


Worthy of mention, I note that my key was generated into default directory /home/.ssh/, so pay attention to your terminal messages/confirmations in order to determine where these key pairs are saved. With this information, you can use the 'browse locally' radial button to navigate the directory to the rsa key file.

An additional disclaimer is that I have had mixed success with the remote backup and automation without password. I have setup the remote backup on four (4) different machines in my house, but only two (2) of those machines will backup without prompting for the password. The other two require a password entry, which isn't a big deal, but it kinda defeats the purpose of an automated and unattended backup solution. I have been unable to determine what I did differently on these machines, but it's never been a big enough deal for me to spend a lot of time troubleshooting. I'm certain it's related to the ssh password key generation sequence, but I just don't care enough to troubleshoot it. I'm adding this as a disclaimer so that I don't mislead anyone into believing I have troubleshooting experience with this portion of the tutorial. I've been successful 50% of the time, but I don't know why it's only 50%?!

Edited by Hedon James, 27 December 2013 - 08:57 AM.

#2 OFFLINE   V.T. Eric Layton

V.T. Eric Layton

    Nocturnal Slacker

  • Forum Admins
  • 21,257 posts

Posted 27 December 2013 - 08:26 PM

NOTE: Discussion for this tutorial can be found here --> http://forums.scotsn...showtopic=67200

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users