Wednesday, August 24, 2011

rsnapshot on SUSE Linux 11.4

A couple of friends of mine are big "rsnapshot" users. I'm glad I took time to install and configure it. I finally have the Apple Time Machine-like backups I have always wanted on Linux. Of course, I'm not using any fancy GUI. That I don't get, but I get lots of cool backups and since rsnapshot takes advantage of "hard links" there is no unnecessary file duplication in my backups.

The install was easy: I just used Yast to find "rsnapshot" and installed it. Next I had to learn enough about it to be dangerous. I edited /etc/rsnapshot.conf, learned to run "rsnapshot configtest" to test my configuration file, set my own "intervals," added some "backup" definitions, set my "snapshot_root" directory, and above all (for me) un-commented "no_create_root" I'm backing up to a USB drive, and I don't want rsnapshot assuming it's mounted when it's not. If the rsnapshot root directory I defined does not exist, I don't want it to be created. I want rsnapshot to stop dead in its tracks.

At first I ran "rsnapshot hourly" manually just to see what it was really doing. After some experimentation (who needs online help or user manuals?), I finally realized the significance of the "intervals" and what rsnapshot is doing with them. Basically it's this: once you've created the number of "hourly" backup directories defined in your interval configuration, the next time you run "rsnapshot hourly" it will replace the oldest directory with a new one. If the next interval "up" is "daily" then I must have run the defined number of hourly backups first. So, let's say my intervals are define thus:


interval        hourly  6
interval        daily   14

If I have only 5 hourly backups then "rsnapshot daily" has nothing to do. If I have six, then the most recent one becomes my first "daily" backup directory and I then have one less hourly directory. Like this:

drwxr-xr-x 3 root root 4096 Aug 23 04:19 daily.0
drwxr-xr-x 3 root root 4096 Aug 21 18:26 daily.1
drwxr-xr-x 3 root root 4096 Aug 21 16:27 daily.2
drwxr-xr-x 3 root root 4096 Aug 21 16:22 daily.3
drwxr-xr-x 3 root root 4096 Aug 21 16:02 daily.4
drwxr-xr-x 3 root root 4096 Aug 24 23:18 hourly.0
drwxr-xr-x 3 root root 4096 Aug 24 20:18 hourly.1
drwxr-xr-x 3 root root 4096 Aug 24 05:02 hourly.2
drwxr-xr-x 3 root root 4096 Aug 24 04:19 hourly.3
drwxr-xr-x 3 root root 4096 Aug 23 19:22 hourly.4

If I run "rsnapshot daily" again, there is nothing to do, and if I look at /var/logs/rsnapshot, that's what it tells me: "hourly.5 not present (yet), nothing to copy."

The next run of "rsnapshot hourly" will create the "hourly.5" (which is number 6).

You can define whatever intervals you want. I could have weekly, monthly, and yearly, etc.

So know I know enough about rsnapshot to use it and enjoy it.




Upgrading to SUSE 11.4

Just a quick note about my recent upgrade from SUSE 11.3 to 11.4: it was darn easy, really. I used the "Network" CD which installed the update from online repositories. I normally don't "upgrade" any OS. I usually start from scratch and do a new clean install. I felt lazy and bold this time, so I just upgraded my OS (after taking images of my disk partitions just in case). I had not heard the "horror" stories of the SUSE 11.4 upgrade. I heard them afterward, and I'm glad I was blissfully ignorant, because for me the upgrade worked just fine and saved a lot of time over a fresh install. I'm now happily running 11.4. 

Dropbox on SUSE Linux 11.4

I created a Dropbox account today and had to piece together bits and pieces of how to get it up and running on SUSE Linux 11.4. Sad to say it was not obvious. The following notes will hopefully make it obvious to the reader (who will probably be me some day in the future when I'm trying to do this again).

Steps to Initial Success
  1. Download the bz2 file from the "Compile from Source (bz2)" link at https://www.dropbox.com/downloading?os=lnx
  2. Unzip and in the resulting nautilus-dropbox-0.6.9 directory, run "./configure" which told me to install "lib-nautilus" (lib-nautilus1 in YAST) and "docutil." From Yast, I installed lib-nautilus1 and nautilus-devel as well as docutil.
  3. Run "make"
  4. And then as root, "make install"
  5. The following steps are done as my standard user ...
  6. Run "dropbox" to see the dropbox command help/program usage.
  7. Run "dropbox -i start" to start it up the first time which brings up a graphical dialog confirming that I will now download the "proprietary daemon" which I did.
  8. Once downloaded, a tutorial dialog comes up and eventually (after providing dropbox login name and password) the nautilus file manager and my "Dropbox" file folder which appears under my home directory but it's a synced folder with my online dropbox file folders.
From the command line I can check the status of the dropbox daemon or stop it:
  1. dropbox status
  2. dropbox stop
Now that the "proprietary daemon" is installed, I can just give the command "dropbox start" to get it going again. And when it's running, I see a cute little open box icon in my task manager tray. If I click on it, the nautilus file browser opens again. So long as the daemon is running, the file manager shows "bold green checks" on the items that are synced and living online in Dropbox:


When the daemon is stopped, the check marks disappear to let me know that folders aren't currently live with Dropbox.

Creating rcdropboxd

I grabbed the text found there and placed it in /etc/init.d/dropboxd. I created a symbolic link to /usr/sbin/rcdropboxd for convenience. Per the text for the script, I created /etc/dropbox/dropbox.conf and added a single line:

DROPBOX_USERS="<my user name>"

Now I can start the daemon by running "rcdropboxd" and I could go into Yast->Configure runlevels and start dropbox as a system service. Of course the "dropbox" command itself as an "autostart" argument that would be used to start dropbox on login. In the end, I prefer to start it when I want it running and stop it when I don't. Note that dropbox is installed with "autostart on" by default. So, from the command line I ran: "dropbox autostart n" to turn it off.