August 25, 20241 yr I wrote this script to be able to back up a single docker container in multiple ways while minimizing docker downtime to less than one second. I run it nightly for Plex as I've found that Plex tends to run a bit smoother if it's restarted every once in a while anyways. Simplified order of operations of this script: Stops docker. Snapshots docker appdata. Starts docker. THEN it will do replications and/or create timestamped tarfiles/rsync folders by using the snapshot as a source. GitHub Link: https://github.com/Blasman/Unraid_Docker_ZFS_AIO_Backup See the sample log file below for a quick idea of what to expect (snapshotting, replicating, and only backing up the Plex DB files): [2024_08_25 05:01:02.840] [PLEX BACKUP STARTED] [2024_08_25 05:01:02.840] Stopping plex docker... [2024_08_25 05:01:08.199] plex docker stopped in 5.357s. [2024_08_25 05:01:08.199] Creating ZFS snapshot of 'pool_main/appdata/plex' using sanoid... [2024_08_25 05:01:08.811] [✔️] 'pool_main/appdata/plex@autosnap_2024-08-25_05:01:08_daily' created in .5912s. [2024_08_25 05:01:08.825] Starting plex docker... [2024_08_25 05:01:09.638] plex docker started in .8106s. ⏱️ 6.795s of total plex downtime since start of 'docker stop' command. [2024_08_25 05:01:09.762] Starting ZFS replication using syncoid... [2024_08_25 05:01:13.586] [✔️] 'pool_main/appdata/plex' >> 'pool_ssds/backup_appdata/plex'. Successful Replication in 3.823s. [2024_08_25 05:01:13.639] Created clone 'pool_main/temp/_temp_plex' from 'pool_main/appdata/plex@autosnap_2024-08-25_05:01:08_daily'. [2024_08_25 05:01:13.685] Mounted 'pool_ssds/backup_plex_db'. [2024_08_25 05:01:13.702] Copying files to '/mnt/pool_ssds/backup_plex_db/[[email protected]] plex Backup'... [2024_08_25 05:01:15.778] [✔️] Copied 1020MB of data in 2.067s. [2024_08_25 05:01:15.866] Destroyed clone 'pool_main/temp/_temp_plex'. [2024_08_25 05:01:17.411] Unmounted 'pool_ssds/backup_plex_db'. [2024_08_25 05:01:17.431] [PLEX BACKUP FINISHED] Run Time: 14.649s.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.