Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
backup_with_rubi [04.12.2017 20:10] – Pascal Suter | backup_with_rubi [04.12.2017 21:21] (current) – Pascal Suter | ||
---|---|---|---|
Line 4: | Line 4: | ||
RUBI is [[http:// | RUBI is [[http:// | ||
- | here’s what it does, or what i think it does ;) | + | here’s what it does: |
- | every time you run rubi, it copies files from a source to a destination. therefore it creates a new folder in the destination drive containing the current date and time in the directory name. it then copys all files from the source into that new directory. but if it did just regular copies, it would cause quite some disk usage, so rubi came up with a clever solution. all the unchanged files are hardlinked to the previously downloaded copies. this way, we only need the disk space once, but we still have all those directories where we have a whole snapshot of every day. No more messing around with incremental stuff :) | + | every time you run rubi, it copies files from a source to a destination. therefore it creates a new folder in the destination drive containing the current date and time in the directory name. it then copies |
+ | |||
+ | if you know rsync, you might be familiar with the '' | ||
the only drawback i found so far.. there’s no documentation.. | the only drawback i found so far.. there’s no documentation.. | ||
- | so here’s how i got it up and running.. but be aware, im not really a linux expert ;) | + | so here’s how i got it up and running: |
- | first, create a new home for rubi. i suggest to install it into /opt so we don’t need to create a directory at all :) | + | first, create a new home for rubi. i suggest to install it into '' |
- | then download and unpack rubi. it can be downloaded from [[http:// | + | then download and unpack rubi. it can be downloaded from [[http:// |
- | by the time i wrote this article, the most recent version was 3.1.0. | + | |
< | < | ||
cd /opt | cd /opt | ||
- | wget http:// | + | wget http:// |
- | tar xzvf rubi-3.2.0.tar.gz | + | tar xzvf rubi-4.0.0.tar.gz |
rm rubi-* | rm rubi-* | ||
</ | </ | ||
- | now we should also install some dependencies and find out where they are installed. the defaults will probably mostly work. | + | by the time I first wrote this article, the most recent version was 3.1.0. and rubi depended on many common tools that where included in most os installs. I recently updated this article and rubi is now at verison 4, where most of these dependencies |
- | rubi needs the folowing shell tools: | + | using '' |
- | cpio, find, mkfifo, rsync and ssh or rsh if you want to backup through a network rather than only from one harddisk to another on the same server. | + | |
- | these tools are mostly system essentials which you probably won’t need to install.. except for rsync.. on debian for example run | + | for example will tell you where to find rsync |
- | apt-get update | + | |
- | apt-get install rsync | + | |
- | using whereis you can find out where these tools are located so we can tell rubi | + | |
- | | + | |
- | for example will tell you where to find cpio | + | |
- | note down all tose paths, we need them for the configuration of rubi | + | note down those paths for rsync and find, we need them for the configuration of rubi |
- | now since there is no documentation to rubi, beat has simply included | + | now since there is no documentation to rubi, beat has simply included |
- | all examples are in '' | + | |
- | that’s | + | you find the scirpt |
cd / | cd / | ||
- | cp rubi-test rubi | + | cp rubi-sample |
- | | + | |
now let’s configure it the way we want it | now let’s configure it the way we want it | ||
- | first the global settings.. just make sure all the path’s | + | first the global settings.. just make sure all the paths are correct. usually |
- | you don’t need to change anything to the source shell functions section | + | you don’t need to change anything to the "source shell functions" |
- | and now the most important part.. our actual backup setups… | + | and now the most important part.. our actual backup setups.. |
here’s an example of what it looks like: | here’s an example of what it looks like: | ||
< | < | ||
# ------ | # ------ | ||
- | # Backup of pssrv | + | # Backup of max |
# ------ | # ------ | ||
- | SRCHOST=192.168.168.43 | + | SRCHOST=localhost |
- | SRCPART="/" | + | SRCPART="/ |
- | BASEDST=/mnt/ | + | BASEDST=/backup/max # base backup |
- | DSTDIR=$BASEDST/ | + | DSTDIR=$BASEDST/ |
OLDDST=" | OLDDST=" | ||
- | SRCCPIO=/ | + | KEEPG=15 |
- | SRCRSYNC=/ | + | KEEPD=15 # |
- | KEEPD=10 # | + | |
- | KEEPS= | + | |
- | UTIME=1 | + | |
doit | tee $DSTDIR.log | doit | tee $DSTDIR.log | ||
</ | </ | ||
- | if you want to do several different backup sets right after each other, simply put several of these blocks at the end of your rubi file. Please make sure to use different BASEDST for each of these blocks (the reason why can be seen a little further down in the text at the BASEDST description). | + | if you want to do several different backup sets right after each other, simply put several of these blocks at the end of your rubi file. Make sure you always include |
- | SRCHOST is the source host name. if you do local backups, thats localhost, otherwhise it’s an ip or hostname of a remot computer and you will need rsh or ssh and rsync if you have larger files than 2gig | + | '' |
- | SRCPART is a list of directories you want to backup. rubi will descend in all subdirectories of these derecotires listed here… | + | '' |
SRCPART="/ | SRCPART="/ | ||
this will create a backup of ''/ | this will create a backup of ''/ | ||
Line 75: | Line 68: | ||
'' | '' | ||
- | '' | + | '' |
+ | |||
+ | '' | ||
- | then you can tell where cpi and rsync are to find on the source server (needed when it’s not in the same place on a remote server) | + | '' |
- | '' | + | don’t forget to put the doit line after each config block.. that's what starts the backup |
- | the other two opitons i don’t understand yet. | + | this " |
- | don’t forget tho put the doit line after the config block.. that's what starts | + | **some thaughts on local backups** |
+ | if you run your backup locally, i.e. you backup your server to a separate harddisk attached to the same server, you should consider adding some extra commands around your doit line, to keep your backup safe: | ||
+ | * '' | ||
+ | * ransomware: ransomware encrypts all files it can find. the hackers behind it will then ask for money in order to give you the key to decrypt your data again. if you have a backup you don't need to bother paying, you simply restore and you're good. Usually ransomware is a piece of software | ||
- | if you want to do anything else, check out the different examples from beat. | ||
now to run your backup simply run | now to run your backup simply run | ||
Line 93: | Line 90: | ||
or by editing the main crontab directly | or by editing the main crontab directly | ||
vi / | vi / | ||
- | **NOTE:** you need to get ssh autologin to work. so make sure your backup machine' | + | **NOTE:** you need to get ssh autologin to work. so make sure your backup machine' |
**addon: backup from or to a qnap**\\ | **addon: backup from or to a qnap**\\ | ||
- | **NOTE** //the description | + | **NOTE** //the description below was written before Qnap supported Docker containers. Nowadays I recommend to simply setup a docker container and run your linux stuff in there rather than hacking it into the qnap OS as the docker method will remain functional evena after firmware upgrades. I leave this here just for reference. // |
a little addon to install rubi on a qnap or to backup from a qnap (only on intel versions, as there seems to be no ipkg repo for the ARM based ones) | a little addon to install rubi on a qnap or to backup from a qnap (only on intel versions, as there seems to be no ipkg repo for the ARM based ones) |