{"id":26,"date":"2026-07-09T17:38:00","date_gmt":"2026-07-09T15:38:00","guid":{"rendered":"https:\/\/www.lukaswojcik.com\/blog\/?p=26"},"modified":"2026-10-26T12:20:43","modified_gmt":"2026-10-26T11:20:43","slug":"how-to-automate-raspberry-pi-backups-to-a-unifi-nas","status":"publish","type":"post","link":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/","title":{"rendered":"How to Automate Raspberry Pi Backups to a UniFi NAS"},"content":{"rendered":"<p>A daily backup on a UniFi UNAS Pro provides a second copy of Raspberry Pi application data. This example saves selected directories and MySQL databases through SMB, the network file-sharing protocol. A NAS copy alone is not a complete recovery plan: restore tests and a separate offline or off-site copy remain necessary.<\/p>\n<h2>Prerequisites and scope<\/h2>\n<p>The example uses the Linux account <code>pi<\/code>, the home directory <code>\/home\/pi<\/code>, Bash and a MySQL-compatible dump client. Account names, numeric user\/group IDs, database names and source directories must match the installation. Every source directory must be readable by the backup account. Copying the directory of a running Docker database with <code>tar<\/code> can mix files from different moments. The database may change one file while another is already being copied. A database export avoids treating these changing files as an ordinary folder.<\/p>\n<h2>1. NAS preparation<\/h2>\n<p>In UniFi Drive, a shared drive named <code>Pi_Backups<\/code> holds the backup files. A dedicated account needs write access to this share and File Services credentials for SMB. A UniFi console login is not necessarily an SMB login. The SMB service must be enabled; the exact labels depend on the installed Drive version.<\/p>\n<h2>2. SMB share connection<\/h2>\n<p>The package <code>cifs-utils<\/code> supplies the SMB mount helper. The following setup commands require administrative privileges:<\/p>\n<pre class=\"wp-block-code-beautifier-block-code\"><code>sudo apt update\nsudo apt install cifs-utils\nsudo mkdir -p \/mnt\/unas_backup<\/code><\/pre>\n<p>The file <code>\/etc\/.unas_creds<\/code>, created with <code>sudo nano \/etc\/.unas_creds<\/code>, contains two lines:<\/p>\n<pre class=\"wp-block-code-beautifier-block-code\"><code>username=backup_user\npassword=REPLACE_WITH_SMB_PASSWORD<\/code><\/pre>\n<p>The password remains plain text in this file. File permissions restrict access; a leading dot does not encrypt credentials. The file must belong to root:<\/p>\n<pre class=\"wp-block-code-beautifier-block-code\"><code>sudo chown root:root \/etc\/.unas_creds\nsudo chmod 600 \/etc\/.unas_creds<\/code><\/pre>\n<p>The following entry belongs in <code>\/etc\/fstab<\/code>. The address and share name are examples; UID and GID 1000 must correspond to the backup account, as checked with <code>id pi<\/code>. The NAS still enforces its own access permissions.<\/p>\n<pre class=\"wp-block-code-beautifier-block-code\"><code>\/\/192.168.1.XXX\/Pi_Backups \/mnt\/unas_backup cifs credentials=\/etc\/.unas_creds,uid=1000,gid=1000,iocharset=utf8,_netdev,nofail 0 0<\/code><\/pre>\n<p><code>sudo mount \/mnt\/unas_backup<\/code> tests this specific mount. With <code>nofail<\/code>, boot can continue without the NAS. A failed mount still prevents backups; after NAS recovery, mounting again is necessary. SMB does not automatically imply encrypted transport. Encryption requirements must be configured and checked separately.<\/p>\n<h2>3. Database access<\/h2>\n<p>The file <code>\/home\/pi\/.my.cnf<\/code> belongs to the account running the job and contains the database credentials below. <code>chmod 600 \/home\/pi\/.my.cnf<\/code> restricts access. The dedicated database account requires the privileges documented for the chosen dump options, including routines and events.<\/p>\n<pre class=\"wp-block-code-beautifier-block-code\"><code>[client]\nuser=backup_user\npassword=REPLACE_WITH_DATABASE_PASSWORD<\/code><\/pre>\n<h2>4. Backup script<\/h2>\n<p>The following script belongs in <code>\/home\/pi\/pi_backup.sh<\/code>. Before use, <code>app1 app2<\/code> and <code>TARGET_FOLDERS<\/code> must be replaced with the actual database and directory names. For MariaDB, the installed <code>mariadb-dump<\/code> client and its supported options need a separate check.<\/p>\n<pre class=\"wp-block-code-beautifier-block-code\"><code>#!\/bin\/bash\nset -euo pipefail\numask 077\nPATH=\/usr\/local\/bin:\/usr\/bin:\/bin\nNAS_MOUNT=\"\/mnt\/unas_backup\"\nTARGET_FOLDERS=(\/var\/www\/html \/etc\/nginx)\nDATABASES=(app1 app2)\nexec 9&gt;\/home\/pi\/.pi-backup.lock\nflock -n 9 || { echo \"Backup already running\" &gt;&amp;2; exit 1; }\nmountpoint -q \"$NAS_MOUNT\" || { echo \"NAS is not mounted\" &gt;&amp;2; exit 1; }\n[[ $(findmnt -n -o FSTYPE --target \"$NAS_MOUNT\") == cifs ]] || exit 1\nBACKUP_ID=$(date +%Y-%m-%d_%H-%M-%S)\nWORK_DIR=\"$NAS_MOUNT\/.partial-$BACKUP_ID\"\nDEST_DIR=\"$NAS_MOUNT\/$BACKUP_ID\"\nmkdir -- \"$WORK_DIR\"\ntrap 'echo \"Backup failed; incomplete directory: $WORK_DIR\" &gt;&amp;2' ERR\nmysqldump --defaults-extra-file=\/home\/pi\/.my.cnf   --single-transaction --routines --events --triggers   --databases \"${DATABASES[@]}\" | gzip &gt; \"$WORK_DIR\/databases.sql.gz\"\ngzip -t \"$WORK_DIR\/databases.sql.gz\"\ntar -czf \"$WORK_DIR\/files.tar.gz\" -- \"${TARGET_FOLDERS[@]}\"\ntar -tzf \"$WORK_DIR\/files.tar.gz\" &gt; \/dev\/null\nprintf '%s\\n' \"$BACKUP_ID\" &gt; \"$WORK_DIR\/COMPLETE\"\nmv -- \"$WORK_DIR\" \"$DEST_DIR\"\necho \"Backup written: $DEST_DIR\"\n<\/code><\/pre>\n<p><code>pipefail<\/code> exposes dump errors hidden by a successful gzip process. This straight-line script stops on a failed dump or file archive. An incomplete run keeps a <code>.partial-<\/code> directory; the final directory appears only after both archive checks succeed. These checks can detect damaged archive files. A readable archive can still lack a required database or configuration file. Only a restore test shows whether the application works with the saved data.<\/p>\n<p><code>--single-transaction<\/code> provides a consistent view for transactional tables such as InnoDB. This guarantee does not cover tables without transaction support or changes to the database structure during the export, such as adding a column. Those cases need a different backup strategy. Files copied afterward are not automatically synchronized with that database snapshot. Applications requiring consistency between uploads and database records need a coordinated maintenance window or suitable snapshot procedure.<\/p>\n<h2>5. Schedule and verification<\/h2>\n<p>After <code>chmod +x \/home\/pi\/pi_backup.sh<\/code>, a manual run under the same account must succeed. The following entry in the <code>pi<\/code> account\u2019s <code>crontab -e<\/code> starts the job at 02:00 in the cron service\u2019s local timezone:<\/p>\n<pre class=\"wp-block-code-beautifier-block-code\"><code>0 2 * * * \/home\/pi\/pi_backup.sh &gt;&gt; \/home\/pi\/backup_log.txt 2&gt;&amp;1<\/code><\/pre>\n<p>Each run adds lines to the same log. Regular rotation starts a new log file and removes older log files according to a separate retention rule, preventing unlimited growth. Monitoring must detect failed jobs and missing recent completed backups. The script deliberately performs no automatic deletion. A retention policy defines how long completed backups remain available. Before an old backup is deleted, the policy must account for free space, unfinished backups and the most recent backup that passed a restore test.<\/p>\n<figure class=\"lw-diagram\">\n<img decoding=\"async\" src=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/diagrams\/dia-26-review-20261024.png\" width=\"1120\" height=\"580\" loading=\"lazy\" alt=\"Backup flow with a lock, mount check, partial directory, checked archives and final directory; no automatic deletion.\"><figcaption>Backup flow with a lock, mount check, partial directory, checked archives and final directory; no automatic deletion.<\/figcaption><\/figure>\n<div class=\"lw-faq\">\n<h2>Questions and answers<\/h2>\n<h3>Does this back up the entire Raspberry Pi?<\/h3>\n<p>No. The result contains the selected application databases and directories. Operating system installation, boot configuration, database accounts and any omitted services require a separately documented recovery procedure.<\/p>\n<h3>When is a backup usable?<\/h3>\n<p>Only a restore test on an isolated test system demonstrates recoverability. The test needs a compatible database version, imported SQL, extracted files and an application check. A gzip size check or a COMPLETE marker cannot replace that test.<\/p>\n<h3>Why is there no automatic cleanup?<\/h3>\n<p>Deleting old copies after an unverified run can destroy the last usable recovery point. Retention needs a separate policy that checks successful restores and available space.<\/p>\n<\/div>\n<div class=\"lw-quellen\">\n<h2>Sources<\/h2>\n<ul>\n<li><a href=\"https:\/\/help.ui.com\/hc\/en-us\/articles\/360012192813-Introduction-to-UniFi\" target=\"_blank\" rel=\"noopener noreferrer\">Introduction to UniFi<\/a><\/li>\n<li><a href=\"https:\/\/www.raspberrypi.com\/documentation\/computers\/os.html\" target=\"_blank\" rel=\"noopener noreferrer\">Raspberry Pi OS documentation<\/a><\/li>\n<li><a href=\"https:\/\/www.gnu.org\/software\/bash\/manual\/html_node\/Pipelines\" target=\"_blank\" rel=\"noopener noreferrer\">Bash \u2014 Pipelines<\/a><\/li>\n<li><a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.4\/en\/mysqldump.html\" target=\"_blank\" rel=\"noopener noreferrer\">MySQL 8.4 \u2014 mysqldump<\/a><\/li>\n<li><a href=\"https:\/\/www.freedesktop.org\/software\/systemd\/man\/257\/systemd.mount.html\" target=\"_blank\" rel=\"noopener noreferrer\">systemd \u2014 mount<\/a><\/li>\n<li><a href=\"https:\/\/help.ui.com\/hc\/en-us\/articles\/39670142044567-Accessing-UniFi-NAS-UNAS-Drives\" target=\"_blank\" rel=\"noopener noreferrer\">UniFi \u2014 Accessing NAS Drives<\/a><\/li>\n<li><a href=\"https:\/\/help.ui.com\/hc\/en-us\/articles\/34859891876503-Using-Active-Directory-Credentials-for-SMB-Access-in-UniFi-Drive\" target=\"_blank\" rel=\"noopener noreferrer\">UniFi \u2014 SMB Credentials<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Automate Raspberry Pi backups to UniFi UNAS Pro: SMB shares, CIFS mounts, file backups, database exports and daily archives. The guide combines directory archives and mysqldump with protected credentials and scheduled backup runs.<\/p>\n","protected":false},"author":1,"featured_media":31861,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[91106,91225,91064,91181,91237,91707],"class_list":["post-26","post","type-post","status-publish","format-standard","hentry","category-it-networks","tag-automation","tag-backup","tag-linux","tag-raspberry-pi","tag-self-hosting","tag-unifi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Automate Raspberry Pi Backups to a UniFi NAS | Lukas Wojcik<\/title>\n<meta name=\"description\" content=\"Automate Raspberry Pi backups to UniFi UNAS Pro: SMB shares, CIFS mounts, file backups, database exports and daily archives.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Automate Raspberry Pi Backups to a UniFi NAS | Lukas Wojcik\" \/>\n<meta property=\"og:description\" content=\"Automate Raspberry Pi backups to UniFi UNAS Pro: SMB shares, CIFS mounts, file backups, database exports and daily archives.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/\" \/>\n<meta property=\"og:site_name\" content=\"Lukas Wojcik - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-09T15:38:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-26T11:20:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll2-26-26.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Lukas Wojcik\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lukas Wojcik\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/it-networks\\\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/it-networks\\\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\\\/\"},\"author\":{\"name\":\"Lukas Wojcik\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"headline\":\"How to Automate Raspberry Pi Backups to a UniFi NAS\",\"datePublished\":\"2026-07-09T15:38:00+00:00\",\"dateModified\":\"2026-10-26T11:20:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/it-networks\\\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\\\/\"},\"wordCount\":785,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/it-networks\\\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flux-voll2-26-26.png\",\"keywords\":[\"Automation\",\"Backup\",\"Linux\",\"Raspberry Pi\",\"Self-Hosting\",\"UniFi\"],\"articleSection\":[\"IT &amp; Networks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/it-networks\\\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/it-networks\\\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\\\/\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/it-networks\\\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\\\/\",\"name\":\"How to Automate Raspberry Pi Backups to a UniFi NAS | Lukas Wojcik\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/it-networks\\\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/it-networks\\\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flux-voll2-26-26.png\",\"datePublished\":\"2026-07-09T15:38:00+00:00\",\"dateModified\":\"2026-10-26T11:20:43+00:00\",\"description\":\"Automate Raspberry Pi backups to UniFi UNAS Pro: SMB shares, CIFS mounts, file backups, database exports and daily archives.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/it-networks\\\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/it-networks\\\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/it-networks\\\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flux-voll2-26-26.png\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flux-voll2-26-26.png\",\"width\":1200,\"height\":630,\"caption\":\"How to Automate Raspberry Pi Backups to a UniFi NAS\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/it-networks\\\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/de\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Automate Raspberry Pi Backups to a UniFi NAS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\",\"name\":\"Lukas Wojcik - Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\",\"name\":\"Lukas Wojcik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"width\":424,\"height\":636,\"caption\":\"Lukas Wojcik\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\"},\"sameAs\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Automate Raspberry Pi Backups to a UniFi NAS | Lukas Wojcik","description":"Automate Raspberry Pi backups to UniFi UNAS Pro: SMB shares, CIFS mounts, file backups, database exports and daily archives.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/","og_locale":"en_US","og_type":"article","og_title":"How to Automate Raspberry Pi Backups to a UniFi NAS | Lukas Wojcik","og_description":"Automate Raspberry Pi backups to UniFi UNAS Pro: SMB shares, CIFS mounts, file backups, database exports and daily archives.","og_url":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/","og_site_name":"Lukas Wojcik - Blog","article_published_time":"2026-07-09T15:38:00+00:00","article_modified_time":"2026-10-26T11:20:43+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll2-26-26.png","type":"image\/png"}],"author":"Lukas Wojcik","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Lukas Wojcik","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/#article","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/"},"author":{"name":"Lukas Wojcik","@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"headline":"How to Automate Raspberry Pi Backups to a UniFi NAS","datePublished":"2026-07-09T15:38:00+00:00","dateModified":"2026-10-26T11:20:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/"},"wordCount":785,"commentCount":0,"publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll2-26-26.png","keywords":["Automation","Backup","Linux","Raspberry Pi","Self-Hosting","UniFi"],"articleSection":["IT &amp; Networks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/","url":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/","name":"How to Automate Raspberry Pi Backups to a UniFi NAS | Lukas Wojcik","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/#primaryimage"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll2-26-26.png","datePublished":"2026-07-09T15:38:00+00:00","dateModified":"2026-10-26T11:20:43+00:00","description":"Automate Raspberry Pi backups to UniFi UNAS Pro: SMB shares, CIFS mounts, file backups, database exports and daily archives.","breadcrumb":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/#primaryimage","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll2-26-26.png","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll2-26-26.png","width":1200,"height":630,"caption":"How to Automate Raspberry Pi Backups to a UniFi NAS"},{"@type":"BreadcrumbList","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/it-networks\/how-to-automate-raspberry-pi-backups-to-a-unifi-nas\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lukaswojcik.com\/blog\/de\/"},{"@type":"ListItem","position":2,"name":"How to Automate Raspberry Pi Backups to a UniFi NAS"}]},{"@type":"WebSite","@id":"https:\/\/www.lukaswojcik.com\/blog\/#website","url":"https:\/\/www.lukaswojcik.com\/blog\/","name":"Lukas Wojcik - Blog","description":"","publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lukaswojcik.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9","name":"Lukas Wojcik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","width":424,"height":636,"caption":"Lukas Wojcik"},"logo":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg"},"sameAs":["https:\/\/www.lukaswojcik.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/26","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/comments?post=26"}],"version-history":[{"count":10,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/26\/revisions"}],"predecessor-version":[{"id":26844,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/26\/revisions\/26844"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media\/31861"}],"wp:attachment":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media?parent=26"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/categories?post=26"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/tags?post=26"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}