Rsnapshot on Puppy Linux


4/23/16 update: click for instructions about Rsnapshot on generic Linux.

Background

May of 2011, I wanted to get rsnapshot running on my Lucid Puppy Linux 5.2.5 installation. I received a package of rsnapshot files from user DPUP5520 on the puppy forum. The 72KB rsnapshot package file is now available from the Increa wiki file gallery under the 'Computer Code' group. However, when I installed this pet file into Puppy, and ran rsnapshot, rsnapshot complained about missing a 'DirHandle.pm' file and told me all the places it had looked. Turns out rsnapshot is a PERL script, which needs run-time libraries, and I was missing one.

In order to fix this, I obtained the missing perl file from within the 'perl-modules' library package. You can visit http://packages.ubuntu.com/lucid/all/perl-modules/download, and click on the 'security.ubuntu.com/ubuntu' link to download the file. The Puppy package manager will sprinkle the .deb file contents into the right directories in your Puppy installation. The 3.4MB perl-module package file is also now available from the Increa wiki file gallery under the 'Computer Code' group.

If you want to see what files are acquired with the above action, visit http://packages.ubuntu.com/lucid/perl-modules and click on the 'list of files' link. The file '/usr/share/perl/5.10.1/DirHandle.pm' is the file that rsnapshot was complaining about, so I was going to download the deb file and extract only that file, but then realized there may be others that are missing, and I would uncover them one at a time as I installed them. So, I just let the Pupply install tool install all of the files. The 'perl-modules' package is part of the perl package; not sure why Puppy 5.2.5 includes the perl language but does not include the files in perl-modules.

Using Rsnapshot

After installing the above two packages, rsnapshot ran fine. I duplicated a copy of the A'/etc/rsnapshot.conf.default' file and renamed it'/etc/rsnapshot.conf'. Here's what I changed in the rsnahpshot.conf file to setup on my Dell D620 Lucid Puppy 5.2.5 installation:

snapshot_root /mnt/sdb1/puppy-rsnapshot-backups
no_create_root 1
cmd_cp /bin/cp
cmd_du /user/bin/du
cmd_rsnapshot_diff /usr/bin/rsnapshot-diff
interval monthly 3
logfile /var/log/rsnapshot
du_args -csh
one_fs 1
link_dest 1
use_lazy_deletes 1
backup /root/
backup /usr/local/
backup /etc/


The rsnapshot perl script executes without error, except when it tries to use the command line 'logger' program, it passes an '-i' parameter to log the process number. The logger program running on Puppy doesn't know how to do that parameter so an error message is generated. Everything still seems to log fine into the '/var/log/rsnapshot' file, so I'm not going to try to fix the '-i' problem at this time.

In the rsnapshot file, 'interval' is one of the parameters. This is hugely misnamed configuration option. It is not an interval, but rather the max number of backup snapshots that will be kept of any one type. Here's what actually happens:

When the command line 'rsnapshot monthly' is run, if the weekly file with the highest weekly filename (.3 by default) exists, it will be renamed monthly.0 and existing monthly numbers will be shuffled up, discarding the previous max monthly number (.2 by default) if it exists.

When 'rsnapshot weekly' is run, if the daily file with the highest daily filename (.6 by default) exists, it will be renamed weekly.0 and existing weekly numbers will be huffled up, discarding the previous max weekly number (.3 by default) if it exists.

When 'rsnapshot daily' is run, if the hourly file with the highest hourly filename (.5 by default) exists, it will be renamed daily.0 and existing daily numbers will be shuffled up, discarding the previous max daily number (.3 by default) if it exists.

When 'rsnapshot hourly' is run, it will always generate a new hourly '.0' backup and shuffle all existing numbers higher; the previous max hourly number ('.5' by default) will be discarded.

You can run rsnapshot manually whenever you want, but normally it's used with the cron process to automatically run it at certain times. Here is a screenshot of how I used Pschedule (under the System menu) to setup my crontab entries (last 4 entries are relevant to this discussion).

Image


Results

If you want to know why I really valued having Rsnapshot up and running, please visit my other Rsnapshot Wiki page. One reason is the intelligent use of incremental backups with directory hard links. This capability is easily seen when comparing backups destined for NTFS or EXT3. NTFS allows shortcuts which are sort of like EXT3 soft links. But NTFS does not allow hard links, which EXT3 does. With a hardlink, a computer file is "in" more than one directory with no priority or preference as to which is the "real" location. Two or more file directories point to the same physical location on the disk, yet the file data physically exists only at one place on the hard drive. If you delete either directory entry, all the others stay intact. When the last is deleted, the space taken by the actual file data is released.

On an NTFS USB external drive, here is how space is being used for my first few backups:

NTFS
# du -sh /mnt/sdb1/puppy-rsnapshot-backups/*
103M /mnt/sdb1/puppy-rsnapshot-backups/hourly.0
103M /mnt/sdb1/puppy-rsnapshot-backups/hourly.1
103M /mnt/sdb1/puppy-rsnapshot-backups/hourly.2


On an ext3 filesystem, here is how space is being used for my first few backups:

EXT3
#du -sh /home/puppy-rsnapshot-backups/*
114M /home/puppy-rsnapshot-backups/hourly.0
6.3M /home/puppy-rsnapshot-backups/hourly.1
6.3M /home/puppy-rsnapshot-backups/hourly.2


Notice the ext3 filesystem, which allows rsnapshot to use hard links save a lot of space. Although browsing into each backup directory looks as if each file is there, really there is only one copy of each file on the disk. Under NTFS, each created backup directory does have separate copies of the files, which takes up a LOT more space.


Created by admin. Last Modification: Saturday 23 of April, 2016 06:44:55 CDT by brian.