{"id":12569,"date":"2019-01-14T17:48:32","date_gmt":"2019-01-14T16:48:32","guid":{"rendered":"http:\/\/blog.wenzlaff.de\/?p=12569"},"modified":"2021-01-23T16:59:55","modified_gmt":"2021-01-23T15:59:55","slug":"backup-und-restore-von-openhab-2-auf-dem-raspberry-pi","status":"publish","type":"post","link":"http:\/\/blog.wenzlaff.de\/?p=12569","title":{"rendered":"Backup und Restore von openHAB 2 auf dem Raspberry Pi"},"content":{"rendered":"<p>Sicherung von Daten ist ja immer gut. Wenn dann mal die SD-Karte crasht, kann man sein openHAB 2 wieder herstellen. In openHAB 2 ist eine Backup und Restore Funktion integriert. <\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Openhab2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Openhab2.jpg\" alt=\"\" width=\"2732\" height=\"2048\" class=\"aligncenter size-full wp-image-12574\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Openhab2.jpg 2732w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Openhab2-300x225.jpg 300w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Openhab2-768x576.jpg 768w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Openhab2-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<p>Man braucht nur das <a href=\"https:\/\/github.com\/openhab\/openhab-distro\/blob\/main\/distributions\/openhab\/src\/main\/resources\/bin\/backup\" rel=\"noopener noreferrer\" target=\"_blank\">Backupscript<\/a> aufrufen:<\/p>\n<pre class=\"lang:default decode:true \" >\r\n\r\nsudo $OPENHAB_RUNTIME\/bin\/backup\r\n\r\n<\/pre>\n<p>und das Passwort eingeben:<!--more--><\/p>\n<pre class=\"lang:default decode:true \" >\r\n\r\nopenhabian@pi-org:\/usr\/share\/openhab2$ sudo $OPENHAB_RUNTIME\/bin\/backup\r\n\r\n[sudo] password for openhabian:\r\n\r\n#########################################\r\n       openHAB 2.x.x backup script\r\n#########################################\r\n\r\nUsing '\/etc\/openhab2' as conf folder...\r\nUsing '\/var\/lib\/openhab2' as userdata folder...\r\nUsing '\/usr\/share\/openhab2\/runtime' as runtime folder...\r\nUsing '\/var\/lib\/openhab2\/backups' as backup folder...\r\nWriting to '\/var\/lib\/openhab2\/backups\/openhab2-backup-19_01_14-17_27_42.zip'...\r\nMaking Temporary Directory if it is not already there\r\nUsing \/tmp\/openhab2\/backup as TempDir\r\nCopying configuration to temporary folder...\r\nRemoving unnecessary files...\r\nBackup Directory is inside userdata, not including in this backup!\r\nZipping folder...\r\nRemoving temporary files...\r\nSuccess! Backup made in \/var\/lib\/openhab2\/backups\/openhab2-backup-19_01_14-17_27_42.zip<\/pre>\n<p>Schon hat man ein Backuparchive in <\/p>\n<p><strong>\/var\/lib\/openhab2\/backups\/<\/strong>openhab2-backup-19_01_14-17_27_42.zip<\/p>\n<p>Einfacher geht es nicht.<\/p>\n<p>Dieses ZIP-Archiv auf einen anderen Datentr\u00e4ger sichern, das ist schon alles. Hier noch weitere Optionen:<\/p>\n<pre class=\"lang:default decode:true \" >\r\n\r\nopenhabian@pi-org:\/usr\/share\/openhab2$ $OPENHAB_RUNTIME\/bin\/backup --help\r\n\r\n#########################################\r\n       openHAB 2.x.x backup script\r\n#########################################\r\n\r\nUsage: backup [--full] [filename]\r\n\r\n  e.g. .\/backup                     &lt;&lt; Makes a file with a timed filename\r\n       .\/backup myBackup.zip        &lt;&lt; Makes a file called myBackup.zip\r\n       .\/backup --full              &lt;&lt; Makes a full backup file with a timed filename\r\n       .\/backup --full myBackup.zip &lt;&lt; Makes a full backup file called myBackup.zip\r\n\r\nUse this script to backup your openHAB configuration, you can use the 'restore' script\r\nfrom any machine to transfer your configuration across to another instance.\r\n\r\nA full backup includes the tmp and cache directories that are normally excluded.\r\n\r\nSet \/var\/lib\/openhab2\/backups to change the default backup directory.\r\nSet  to change the default backup temporary directory.<\/pre>\n<p>Um die Daten aus einen gesicherten Backup wieder herzustellen reicht ein<\/p>\n<pre class=\"lang:default decode:true \" >\r\n\r\n# wenn openhab2 l\u00e4uft stoppen\r\nsudo systemctl stop openhab2\r\n\r\nsudo $OPENHAB_RUNTIME\/bin\/restore $OPENHAB_BACKUPS\/openhab2-backup-19_01_14-17_27_42.zip\r\n\r\n# Ausgabe\r\n##########################################\r\n#       openHAB 2.x.x restore script\r\n##########################################\r\n\r\n# Using '\/etc\/openhab2' as conf folder...\r\n# Using '\/var\/lib\/openhab2' as userdata folder...\r\n# Making Temporary Directory\r\n# Extracting zip file to temporary folder.\r\n\r\n# Backup Information:\r\n -------------------\r\n# Backup Version         | 2.4.0 (You are on 2.4.0)\r\n# Backup Timestamp       | 19_01_14-16_06_23\r\n# Config belongs to user | openhab\r\n#             from group | openhabian\r\n\r\n# Your current configuration will become owned by openhab:openhabian.\r\n\r\n# Any existing files with the same name will be replaced.\r\n# Any file without a replacement will be deleted.\r\n\r\n# Frage mit y Beantworten\r\n#Okay to Continue? [y\/N]: \r\ny\r\n\r\n# Moving system files in userdata to temporary folder\r\n# Deleting old userdata folder...\r\n# Restoring system files in userdata...\r\n# Deleting old conf folder...\r\n# Restoring openHAB with backup configuration...\r\n# Deleting temporary files...\r\n# Backup successfully restored!\r\n\r\n# openhab2 wieder starten\r\nsudo systemctl start openhab2\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Sicherung von Daten ist ja immer gut. Wenn dann mal die SD-Karte crasht, kann man sein openHAB 2 wieder herstellen. In openHAB 2 ist eine Backup und Restore Funktion integriert. Man braucht nur das Backupscript aufrufen: sudo $OPENHAB_RUNTIME\/bin\/backup und das Passwort eingeben:<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[220,852,808,2807,1023,2752,1319],"tags":[1085,3514,3513,2808,1090,1087],"class_list":["post-12569","post","type-post","status-publish","format-standard","hentry","category-anleitung","category-heimautomatisierung","category-linux-2","category-openhab2","category-raspberry-pi","category-raspberry-pi-zero-w","category-sicherheit-2","tag-backup","tag-backup-openhab2","tag-dateisicherung","tag-openhab2","tag-restor","tag-sicherung"],"_links":{"self":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts\/12569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12569"}],"version-history":[{"count":0,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts\/12569\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12569"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}