Cloud Sync Proxmox Backup Dataset to Azure?

Hi, i am still very new to TrueNas, running on 25.04

I have a PBS server in an LXC that uses a dataset for its backup files. I would like to sync this to the cloud.

I assume (need help verifying these):

  • Snapshots take some time
  • I should NOT do snapshot why a pbs backup job is running as blocks will be i indermintae states
  • snapshots enabled in a cloud sync task happen after the pre-script and before the posy script

Requirements:

  • I want to minimize pbs backup server down time
  • as such i would like to restart the pbs for jobs as soon as the clone happens

I have figured out i can run a pre script to wait for pbs jobs to stop and to disable the pbs store for a clone via a pre-script

however i assume the clone happens after the pre script has run and that then the backup runs and then the post script fires

this means i have no way to make pbs available to client until the backup is complete

i was hoping to return it to service as soon as the snapshot has been taken - as such I assume (please validate) that i need to do the snapshot from my pre-script and then do the snapshot cleanup myself in the post script?

some answers:

  1. no snapshots are near instant so maybe i am worrying about this too much
  2. my pbs is so lightly loaded that the race condition of pbs jobs writing during snapshot are pretty low, but there is a non-zero chance it might be
  3. yes sync tasks run the pre- script and post- script before and after the snapshot / backup job

This means if i stop the pbs server as part of backup, it is down for as long as the backup takes.

To give you an idea a fresh backup is (looks to left) taking 8 mins to have done 64GiB (its still going at ~140MiB/s to azure.

So in reality i would miss one back up job (my pbs client jobs runs every 2 hrs - though with the new metadata option i may do hourly soon, they are sooo fast)

So yeah, as a good home sysadmin i am disapointed there is no way to have a script in the GUI that runs after snapshot and before backup, that would allow me to bring the pbs backup.

So i wrote a script that does all of it for me and it:

  1. uses a disabled synctask to define and store creds and connection properties to azure (mean i don’t have to maintain text files)
  2. runs as cron job, extracts creds from sync task and uses it
  3. check PBS running in incus for running tasks and waits for it to stop
  4. stops PBS service running in container (doesnt; stop container) and does snapshot
  5. starts PBS service and starts a push sync of the snapshot to Azure
  6. has good logging and uses logrotate
  7. some error handling (linke incus container being down)

If any one thinks this is useful / interesting let me know and I will push to github for re-use.

tl;dr i now have weekly, quiesced backups of PBS backup store to azure cool blob storage tier

my truenas is now finally in production, time to sunset the synology DS1815+

example logoutput

root@truenas:/var/log# cat pbs-cloud-backup.log | grep -v INFO
[2025-05-13 18:47:08] ℹ️  🚀 Starting PBS snapshot + Azure backup job
[2025-05-13 18:47:08] ❌ Container 'pbs1' not found. Aborting.
[2025-05-13 20:22:16] ℹ️  🚀 Starting PBS snapshot + Azure backup job
[2025-05-13 20:22:16] ℹ️  ⏳ Checking for running PBS tasks...
[2025-05-13 20:22:16] ℹ️  ✅ PBS is idle. Proceeding with backup
[2025-05-13 20:22:16] ℹ️  🛑 Stopping PBS server...
[2025-05-13 20:22:16] ℹ️  📸 Taking ZFS snapshot: cloudbackup-20250513-2022
[2025-05-13 20:22:16] ℹ️  🚀 Restarting PBS server...
[2025-05-13 20:22:16] ℹ️  🔗 Mounting snapshot: /mnt/pbs-snapshot-cloudbackup-20250513-2022
[2025-05-13 20:22:16] ℹ️  🔍 Extracting Azure credentials from Cloud Sync task ID 2...
[2025-05-13 20:22:17] ℹ️  ☁️ Syncing snapshot to Azure container: 'test'
2025/05/13 20:22:27 NOTICE: 2025/05/13 20:22:27 -     1.408 GiB / 12.419 GiB, 11%, 146.965 MiB/s, ETA 1m16s (xfr#1732/11756)
2025/05/13 20:22:37 NOTICE: 2025/05/13 20:22:37 -     2.740 GiB / 13.733 GiB, 20%, 140.938 MiB/s, ETA 1m19s (xfr#2886/12910)
2025/05/13 20:22:47 NOTICE: 2025/05/13 20:22:47 -     4.046 GiB / 14.976 GiB, 27%, 137.623 MiB/s, ETA 1m21s (xfr#4028/14052)
2025/05/13 20:22:57 NOTICE: 2025/05/13 20:22:57 -     5.371 GiB / 16.305 GiB, 33%, 135.807 MiB/s, ETA 1m22s (xfr#5243/15267)
2025/05/13 20:23:07 NOTICE: 2025/05/13 20:23:07 -     6.739 GiB / 17.672 GiB, 38%, 138.359 MiB/s, ETA 1m20s (xfr#6514/16538)
2025/05/13 20:23:17 NOTICE: 2025/05/13 20:23:17 -     8.101 GiB / 19.026 GiB, 43%, 138.429 MiB/s, ETA 1m20s (xfr#7759/17783)
2025/05/13 20:23:27 NOTICE: 2025/05/13 20:23:27 -     9.485 GiB / 20.353 GiB, 47%, 140.123 MiB/s, ETA 1m19s (xfr#8985/19009)
2025/05/13 20:23:37 NOTICE: 2025/05/13 20:23:37 -    10.834 GiB / 21.774 GiB, 50%, 139.747 MiB/s, ETA 1m20s (xfr#10253/20277)
2025/05/13 20:23:47 NOTICE: 2025/05/13 20:23:47 -    12.190 GiB / 23.221 GiB, 52%, 138.870 MiB/s, ETA 1m21s (xfr#11545/21569)
2025/05/13 20:23:57 NOTICE: 2025/05/13 20:23:57 -    13.583 GiB / 24.484 GiB, 55%, 140.557 MiB/s, ETA 1m19s (xfr#12745/22769)
2025/05/13 20:24:07 NOTICE: 2025/05/13 20:24:07 -    14.921 GiB / 25.834 GiB, 58%, 138.753 MiB/s, ETA 1m20s (xfr#13975/23999)
2025/05/13 20:24:17 NOTICE: 2025/05/13 20:24:17 -    16.237 GiB / 27.213 GiB, 60%, 137.350 MiB/s, ETA 1m21s (xfr#15203/25227)
2025/05/13 20:24:27 NOTICE: 2025/05/13 20:24:27 -    17.558 GiB / 28.507 GiB, 62%, 136.232 MiB/s, ETA 1m22s (xfr#16412/26436)
2025/05/13 20:24:37 NOTICE: 2025/05/13 20:24:37 -    18.881 GiB / 29.879 GiB, 63%, 135.237 MiB/s, ETA 1m23s (xfr#17642/27666)
2025/05/13 20:24:47 NOTICE: 2025/05/13 20:24:47 -    20.240 GiB / 31.275 GiB, 65%, 137.152 MiB/s, ETA 1m22s (xfr#18894/28918)
2025/05/13 20:24:57 NOTICE: 2025/05/13 20:24:57 -    21.547 GiB / 32.482 GiB, 66%, 135.637 MiB/s, ETA 1m22s (xfr#20042/30066)
2025/05/13 20:25:07 NOTICE: 2025/05/13 20:25:07 -    22.820 GiB / 33.712 GiB, 68%, 133.029 MiB/s, ETA 1m23s (xfr#21212/31235)
2025/05/13 20:25:17 NOTICE: 2025/05/13 20:25:17 -    24.205 GiB / 35.142 GiB, 69%, 136.540 MiB/s, ETA 1m22s (xfr#22501/32525)
2025/05/13 20:25:27 NOTICE: 2025/05/13 20:25:27 -    25.572 GiB / 36.520 GiB, 70%, 138.346 MiB/s, ETA 1m21s (xfr#23734/33758)
2025/05/13 20:25:37 NOTICE: 2025/05/13 20:25:37 -    26.925 GiB / 37.862 GiB, 71%, 138.007 MiB/s, ETA 1m21s (xfr#24905/34929)
2025/05/13 20:25:47 NOTICE: 2025/05/13 20:25:47 -    28.235 GiB / 39.249 GiB, 72%, 137.435 MiB/s, ETA 1m22s (xfr#26165/36189)
2025/05/13 20:25:57 NOTICE: 2025/05/13 20:25:57 -    29.561 GiB / 40.583 GiB, 73%, 136.146 MiB/s, ETA 1m22s (xfr#27363/37387)
2025/05/13 20:26:07 NOTICE: 2025/05/13 20:26:07 -    30.875 GiB / 41.871 GiB, 74%, 135.610 MiB/s, ETA 1m23s (xfr#28534/38558)
2025/05/13 20:26:17 NOTICE: 2025/05/13 20:26:17 -    32.203 GiB / 43.237 GiB, 74%, 135.827 MiB/s, ETA 1m23s (xfr#29808/39832)
2025/05/13 20:26:27 NOTICE: 2025/05/13 20:26:27 -    33.561 GiB / 44.673 GiB, 75%, 136.774 MiB/s, ETA 1m23s (xfr#31071/41095)
2025/05/13 20:26:37 NOTICE: 2025/05/13 20:26:37 -    34.936 GiB / 46.010 GiB, 76%, 138.968 MiB/s, ETA 1m21s (xfr#32314/42338)
2025/05/13 20:26:47 NOTICE: 2025/05/13 20:26:47 -    36.337 GiB / 47.352 GiB, 77%, 140.709 MiB/s, ETA 1m20s (xfr#33564/43588)
2025/05/13 20:26:57 NOTICE: 2025/05/13 20:26:57 -    37.729 GiB / 48.688 GiB, 77%, 141.801 MiB/s, ETA 1m19s (xfr#34794/44818)
2025/05/13 20:27:07 NOTICE: 2025/05/13 20:27:07 -    39.070 GiB / 50.034 GiB, 78%, 140.623 MiB/s, ETA 1m19s (xfr#36015/46039)
2025/05/13 20:27:17 NOTICE: 2025/05/13 20:27:17 -    40.376 GiB / 51.352 GiB, 79%, 137.242 MiB/s, ETA 1m21s (xfr#37177/47201)
2025/05/13 20:27:27 NOTICE: 2025/05/13 20:27:27 -    41.736 GiB / 52.722 GiB, 79%, 137.896 MiB/s, ETA 1m21s (xfr#38423/48447)
2025/05/13 20:27:37 NOTICE: 2025/05/13 20:27:37 -    43.142 GiB / 54.153 GiB, 80%, 140.381 MiB/s, ETA 1m20s (xfr#39715/49739)
2025/05/13 20:27:47 NOTICE: 2025/05/13 20:27:47 -    44.571 GiB / 55.552 GiB, 80%, 143.595 MiB/s, ETA 1m18s (xfr#40981/51005)
2025/05/13 20:27:57 NOTICE: 2025/05/13 20:27:57 -    45.940 GiB / 56.962 GiB, 81%, 141.814 MiB/s, ETA 1m19s (xfr#42253/52277)
2025/05/13 20:28:07 NOTICE: 2025/05/13 20:28:07 -    47.271 GiB / 58.367 GiB, 81%, 139.930 MiB/s, ETA 1m21s (xfr#43501/53525)
2025/05/13 20:28:17 NOTICE: 2025/05/13 20:28:17 -    48.627 GiB / 59.740 GiB, 81%, 139.655 MiB/s, ETA 1m21s (xfr#44749/54773)
2025/05/13 20:28:27 NOTICE: 2025/05/13 20:28:27 -    50.028 GiB / 61.113 GiB, 82%, 141.072 MiB/s, ETA 1m20s (xfr#46017/56041)
2025/05/13 20:28:37 NOTICE: 2025/05/13 20:28:37 -    51.391 GiB / 62.497 GiB, 82%, 140.533 MiB/s, ETA 1m20s (xfr#47227/57251)
2025/05/13 20:28:47 NOTICE: 2025/05/13 20:28:47 -    52.811 GiB / 63.846 GiB, 83%, 143.392 MiB/s, ETA 1m18s (xfr#48515/58539)
2025/05/13 20:28:57 NOTICE: 2025/05/13 20:28:57 -    54.238 GiB / 65.244 GiB, 83%, 144.194 MiB/s, ETA 1m18s (xfr#49792/59816)
2025/05/13 20:29:07 NOTICE: 2025/05/13 20:29:07 -    55.593 GiB / 66.587 GiB, 83%, 141.084 MiB/s, ETA 1m19s (xfr#51034/61058)
2025/05/13 20:29:17 NOTICE: 2025/05/13 20:29:17 -    56.924 GiB / 67.870 GiB, 84%, 139.140 MiB/s, ETA 1m20s (xfr#52235/62259)
2025/05/13 20:29:27 NOTICE: 2025/05/13 20:29:27 -    58.308 GiB / 69.249 GiB, 84%, 140.160 MiB/s, ETA 1m19s (xfr#53468/63492)
2025/05/13 20:29:37 NOTICE: 2025/05/13 20:29:37 -    59.639 GiB / 70.511 GiB, 85%, 138.131 MiB/s, ETA 1m20s (xfr#54669/64693)
2025/05/13 20:29:47 NOTICE: 2025/05/13 20:29:47 -    60.944 GiB / 70.952 GiB, 86%, 136.067 MiB/s, ETA 1m15s (xfr#55868/65126)
2025/05/13 20:29:57 NOTICE: 2025/05/13 20:29:57 -    62.285 GiB / 70.952 GiB, 88%, 135.953 MiB/s, ETA 1m5s (xfr#57047/65126)
2025/05/13 20:30:07 NOTICE: 2025/05/13 20:30:07 -    63.487 GiB / 70.952 GiB, 89%, 129.697 MiB/s, ETA 58s (xfr#58165/65126)
2025/05/13 20:30:17 NOTICE: 2025/05/13 20:30:17 -    64.799 GiB / 70.952 GiB, 91%, 131.765 MiB/s, ETA 47s (xfr#59394/65126)
2025/05/13 20:30:27 NOTICE: 2025/05/13 20:30:27 -    66.137 GiB / 70.952 GiB, 93%, 134.376 MiB/s, ETA 36s (xfr#60649/65126)
2025/05/13 20:30:37 NOTICE: 2025/05/13 20:30:37 -    67.331 GiB / 70.952 GiB, 95%, 128.698 MiB/s, ETA 28s (xfr#61744/65126)
2025/05/13 20:30:47 NOTICE: 2025/05/13 20:30:47 -    68.603 GiB / 70.952 GiB, 97%, 128.929 MiB/s, ETA 18s (xfr#62910/65126)
2025/05/13 20:30:57 NOTICE: 2025/05/13 20:30:57 -    69.886 GiB / 70.952 GiB, 98%, 130.757 MiB/s, ETA 8s (xfr#64079/65126)
2025/05/13 20:31:05 NOTICE: 2025/05/13 20:31:05 -    70.952 GiB / 70.952 GiB, 100%, 129.827 MiB/s, ETA 0s
[2025-05-13 20:31:05] ℹ️  🧹 Cleaning up snapshot and temp files
[2025-05-13 20:31:06] ℹ️  ✅ Backup complete!
root@truenas:/var/log#