Backup des Raspberry Pi und FHEM auf FTP-Server

Vorgehensweise

zeitlicher Aufruf des Backups mittels cron
Server mounten mittels curlftpfs
Backup mittels rsync
Server unmounten

Installation von curlftpfs:

sudo apt-get install curlftpfs

Erstellung eines Ordners:

sudo mkdir /mnt/backup_server

The configuration for this is fairly simple and is done in the normal fstab file, which is great because you can then use the mount and unmount commands just like any other drive on your system.

#Open and edit your fstab
sudo nano -w /etc/fstab

#At the end of the file enter the following (change to match your setup)
#curlftpfs#USER:PASSWORD@SERVER /local/directory fuse rw,allow_other,uid=user-id 0 0

curlftpfs#USER:PASSWORD@SERVER:PORT /mnt/backup_server fuse rw,allow_other,uid=1000 0 0
#Save and close the file, then mount your directory

sudo mount /mnt/backup_server

Cool, you should be ready to go, I would suggest doing the following just to ensure it’s working

#Go in the mounted directory, check nothings there.
cd /mnt/backup_server
ls -la

#Create a file
touch ./test.txt

As you can see it worked, so you should be a bit more confident that your backups are going to save correctly.

rsync [OPTIONEN] QUELLE(N) ZIEL
rsync -a /opt/fhem/fhem.cfg /mnt/backup_server/BACKUP/48/fhem
rsync -a /opt/fhem/www/gplot/ /mnt/backup_server/BACKUP/48/fhem
/www/gplot/

/opt/fhem/fhem.cfg

/opt/fhem/www/gplot/

 

Finally I enter this into my crontab to backup daily, monthly and weekly

crontab -e

1 1 * * * rsync -asvz –no-owner –no-group /webserver /mnt/backup_server/daily
2 2 2 * * rsync -asvz –no-owner –no-group /webserver /mnt/backup_server/weekly
3 3 3 3 * rsync -asvz –no-owner –no-group /webserver /mnt/backup_server/monthly

2 2 2 * * rsync -asvz –no-owner –no-group /webserver /mnt/backup_server/BACKUP-FOLDER-ON-SERVER/IP-ADDRESS-OF-PI

2 2 2 * * rsync -asvz –no-owner –no-group /webserver /mnt/backup_server/BACKUP/48

sudo rsync -a /opt/fhem/www/gplot /mnt/backup_server/BACKUP/

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>