Advanced backup mechanisms (for zfs)

fcorbelli

Explorer
Joined
Dec 29, 2022
Messages
68
I am new to this forum and do not want to break any rules, better be "careful" that "shameful" :wink:

I have developed a small software (a fork, in fact) for making 'safe' and fast backups (particularly with zfs) that I believe - I repeat believe, I am not sure - has some unique features (full handling of incremental snapshots)
WARNING it is an opensource software, so it is not some kind of advertisement, it has been on github and sourceforce for years

Basically, I would like to have opinions from a strongly storage-oriented community (mistakes, improvements, things to do etc.)

Repeating that it is a fork of software already in the FreeBSD codebase (no snakeoil), can it be interesting, so I can post a couple of examples, or is it better not?

Thanks for any reply
 

MisterE2002

Patron
Joined
Sep 5, 2015
Messages
211
Please add the links to the repo.

To be honest most "small" projects use bash/perl scripts and i try to avoid those as the plague. Error handling is really absent and difficult to do right.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,996
Go ahead and post away. There are a lot of tools out there and if your tool is worth while, then someone will say it. If it's not then you will likely hear that too. The fact that you put so many warnings that it's not snake oil has me a bit concerned so I would caution anyone who may use whatever you have, do it at their own risk, at least until it's proven to be safe software. I'm not sure if this topic belongs here so I'll wait to see what you post.
 

fcorbelli

Explorer
Joined
Dec 29, 2022
Messages
68
Well, in fact this is not exactly the case :)

In the "files" (for version 56.4) there is a pre-compiled FreeBSD binary (otherwise on TrueNAS it is mandatory to install clang++ or g++, a little pain in the ass)

Go ahead and post away. There are a lot of tools out there and if your tool is worth while, then someone will say it. If it's not then you will likely hear that too. The fact that you put so many warnings that it's not snake oil has me a bit concerned so I would caution anyone who may use whatever you have, do it at their own risk, at least until it's proven to be safe software. I'm not sure if this topic belongs here so I'll wait to see what you post.
I learnt the hard way that if you propose something for free to someone (on an opensource forum) you always risk finding users who think you want to sell something
Sad but true

"For free" I mean opensource

In other cases everything is much simpler, indeed you get help and they insert the software into the OpenBSD codebase without drama

Anyway maybe some videos is better than 1.000 words

A bit of more details: we want to update a backup of a folder (actually a dataset, tank/d) frequently.
For example, every hour.
The "folder" is not very big, ~130.000 files for ~70GB (a bunch of .DOC, XLS, PDF etc)


Rsync to a local folder (~22 s)
http://www.francocorbelli.it/zpaqfranz/rsync_backup.avi
The filesystem scan is fast, but still takes tens of seconds


Rsync to NAS (~130 s)
http://www.francocorbelli.it/zpaqfranz/rsync_nas.avi
Scanning for syncing to the NAS is slow (high latency), while transferring changed data is (rather) fast


Backup update from file system to local archive (~ 85 s)
http://www.francocorbelli.it/zpaqfranz/zpaq_backup.avi
Scanning the filesystem takes time and also there is the deduplication stage. Once the data has been calculated, updating the backup is quick, but the preparation phase takes time


Backup upgrade via zfs (~2 s)
http://www.francocorbelli.it/zpaqfranz/zfs_backup.avi
zfs does NOT scan the filesystem, and sends only the data "really needed" to update the backup. So 99% of the "heavy" work is done by zfs

SUGGESTION: first try on some kind of VM without relevant data, just in case


Maybe it's better if I explain again
It is opensource C++ software, so not some kind of Python program or script
Something - broadly speaking - similar to rar or 7z
Since there is no easy way to install the clang++ compiler on TrueNAS, it is not straightforward to compile from source.
I then put a compiled binary (and this is where the element of caution is) on sourceforge

So my advice is
  • If you have FreeBSD (or Windows, or Linux, or OpenBSD, or Mac, or Solaris), download the source and compile yourself (so 100% sure). It is done in a way that doesn't require makefiles or complex things
  • With TrueNAS install the compiler [actually I don't know how to do it, I would say that you have to change the FreeBSD configuration files with the related repositories, but I'm sure it is "doable"], download the source and compile it (100% sure)
  • If you have a virtual/test TrueNAS (no important data) you can also try the binary from sourceforge, if you think you can trust :)

I hope this is clearer: a binary objectively poses a security risk, whoever prepared it
Clearly those who have been following me on technical forums for years do not have these doubts, but it is good to be careful
 

fcorbelli

Explorer
Joined
Dec 29, 2022
Messages
68
Shortest version for FreeBSD users (without the new zfsbackup-zfsrestore-zfsreceive of build 56.4)
Code:
pkg install zpaqfranz

The "almost latest"
Code:
wget http://www.francocorbelli.it/zpaqfranz.cpp -O zpaqfranz.cpp
clang++ -Dunix zpaqfranz.cpp  -pthread -o zpaqfranz -static


On sourceforge-github there is the "spiegone", I try to summarize it

Giving a dataset (tank/d) store incrementally-zfs-send-generated-streams on /temporaneo/thebackup.zpaq
This function is in 56.4, quickest-and-dirtiest example
Code:
zpaqfranz zfsbackup /temporaneo/thebackup.zpaq /tank/d

This will (just about)
- take the last snapshot +1 (let's say 00000027)
- zfs send incremental from snapshot X-1 (00000026) to X (00000027) into the archive (compressed, encrypted etc)
- (optionally with -kill) destroy snapshot X-1 (00000026)

On the next run
- take the last snapshot +1 (let's say 00000028)
- zfs send incremental from snapshot X-1 (00000027) to X (00000028) into the archive (compressed, encrypted etc)
- (optionally with -kill) destroy snapshot X-1 (00000027)



For "file-level" backups, about
- take the snapshot X
- deduplicating-add into archive (compressed, encrypted etc)
- destroy the snapshot X
(...)
- take the snapshot X
- deduplicating-add into archive (compressed, encrypted etc)
- destroy the snapshot X
(...)
Now you can extract directly from every version (=snapshot), something like Time Machine, without needing to zfs receive

Very-quick-very-dirty (for tank/d on /temporaneo/thebak.zpaq)
Code:
zfs snapshot tank/d@fc
zpaqfranz a /temporaneo/thebak.zpaq /tank/d/.zfs/snapshot/fc  -to /tank/d
zfs destroy tank/d@fc


I'm sure the users of this forum, accustomed to the concept of snapshots, understand the advantages well
 
Joined
Oct 22, 2019
Messages
3,641
Doesn't syncoid already offer this type of "fire and go" ZFS-to-ZFS backup solution?
 

fcorbelli

Explorer
Joined
Dec 29, 2022
Messages
68
Doesn't syncoid already offer this type of "fire and go" ZFS-to-ZFS backup solution?
AFAIK no
I use syncoid to make replicas, for "zfs-to-zfs" (very good, indeed)

This is "zfs to file" (zfsbackup) or "7z-with-snapshot" (normal add)
You could see here

Code:
H:\backup\rambo_incrementale>zpaqfranz l incrementale.zpaq
zpaqfranz v56.4j-JIT-L (HW BLAKE3), SFX64 v55.1, (30 Dec 2022)
incrementale.zpaq:
111 versions, 111 files, 164.996 fragments, 5.293 blocks, 67.417.370.407 bytes (62.79 GB)


- 2022-12-28 17:48:00          17.136.907  0644 /tmp/hasho_tank_d_zpaqfranz00000032.txt
- 2022-12-28 18:20:46          17.136.905  0644 /tmp/hasho_tank_d_zpaqfranz00000033.txt
- 2022-12-28 19:20:46          17.141.951  0644 /tmp/hasho_tank_d_zpaqfranz00000034.txt
- 2022-12-28 20:20:46          17.141.951  0644 /tmp/hasho_tank_d_zpaqfranz00000035.txt
- 2022-12-28 21:20:46          17.141.951  0644 /tmp/hasho_tank_d_zpaqfranz00000036.txt
- 2022-12-29 08:20:47          17.141.951  0644 /tmp/hasho_tank_d_zpaqfranz00000037.txt
- 2022-12-29 09:20:46          17.141.951  0644 /tmp/hasho_tank_d_zpaqfranz00000038.txt
- 2022-12-29 10:20:46          17.143.612  0644 /tmp/hasho_tank_d_zpaqfranz00000039.txt
- 2022-12-29 11:20:46          17.144.724  0644 /tmp/hasho_tank_d_zpaqfranz00000040.txt
- 2022-12-29 12:20:46          17.144.687  0644 /tmp/hasho_tank_d_zpaqfranz00000042.txt
- 2022-12-29 13:20:46          17.144.675  0644 /tmp/hasho_tank_d_zpaqfranz00000044.txt
- 2022-12-29 14:20:46          17.144.956  0644 /tmp/hasho_tank_d_zpaqfranz00000045.txt
- 2022-12-29 15:20:47          17.145.044  0644 /tmp/hasho_tank_d_zpaqfranz00000046.txt
- 2022-12-29 16:20:46          17.145.008  0644 /tmp/hasho_tank_d_zpaqfranz00000047.txt
- 2022-12-29 17:20:46          17.147.012  0644 /tmp/hasho_tank_d_zpaqfranz00000048.txt
- 2022-12-29 18:20:46          17.147.012  0644 /tmp/hasho_tank_d_zpaqfranz00000049.txt
- 2022-12-29 19:20:46          17.147.445  0644 /tmp/hasho_tank_d_zpaqfranz00000050.txt
- 2022-12-29 20:20:46          17.147.540  0644 /tmp/hasho_tank_d_zpaqfranz00000051.txt
- 2022-12-29 21:20:46          17.147.540  0644 /tmp/hasho_tank_d_zpaqfranz00000052.txt
- 2022-12-30 08:20:47          17.147.540  0644 /tmp/hasho_tank_d_zpaqfranz00000053.txt
- 2022-12-30 09:20:46          17.148.056  0644 /tmp/hasho_tank_d_zpaqfranz00000054.txt
- 2022-12-30 10:20:46          17.147.740  0644 /tmp/hasho_tank_d_zpaqfranz00000055.txt
- 2022-12-30 11:20:46          17.158.963  0644 /tmp/hasho_tank_d_zpaqfranz00000056.txt
- 2022-12-30 12:20:46          17.159.341  0644 /tmp/hasho_tank_d_zpaqfranz00000057.txt
- 2022-12-30 13:20:46          17.159.479  0644 /tmp/hasho_tank_d_zpaqfranz00000058.txt
- 2022-12-30 14:20:46          17.159.486  0644 /tmp/hasho_tank_d_zpaqfranz00000059.txt
- 2022-12-30 15:20:47          17.159.780  0644 /tmp/hasho_tank_d_zpaqfranz00000060.txt
- 2022-12-30 16:20:46          17.159.640  0644 /tmp/hasho_tank_d_zpaqfranz00000061.txt
- 2022-12-30 17:20:46          17.159.640  0644 /tmp/hasho_tank_d_zpaqfranz00000062.txt
- 2022-12-30 17:22:14          17.159.647  0644 /tmp/hasho_tank_d_zpaqfranz00000063.txt
- 2022-12-30 18:14:54          17.159.642  0644 /tmp/hasho_tank_d_zpaqfranz00000064.txt
- 2022-12-30 18:20:46          17.159.640  0644 /tmp/hasho_tank_d_zpaqfranz00000065.txt
- 2022-12-30 19:20:46          17.159.639  0644 /tmp/hasho_tank_d_zpaqfranz00000066.txt
- 2022-12-30 20:20:46          17.159.640  0644 /tmp/hasho_tank_d_zpaqfranz00000067.txt
- 2022-12-30 21:20:46          17.159.640  0644 /tmp/hasho_tank_d_zpaqfranz00000068.txt
- 2022-12-31 08:20:46          17.159.640  0644 /tmp/hasho_tank_d_zpaqfranz00000069.txt
- 2022-12-31 09:20:46          17.159.640  0644 /tmp/hasho_tank_d_zpaqfranz00000070.txt
- 2022-12-31 10:20:46          17.159.640  0644 /tmp/hasho_tank_d_zpaqfranz00000071.txt
- 2022-12-31 11:20:46          17.159.640  0644 /tmp/hasho_tank_d_zpaqfranz00000072.txt
- 2022-12-17 15:58:42      71.790.160.936  0644 00000001.zfs
- 2022-12-17 16:22:59              49.744  0644 00000002.zfs
- 2022-12-17 16:30:19              45.016  0644 00000003.zfs
- 2022-12-17 16:33:35          17.166.680  0644 00000004.zfs
- 2022-12-17 17:43:10             927.624  0644 00000005.zfs
- 2022-12-17 17:46:03             146.384  0644 00000006.zfs
- 2022-12-17 17:47:40              80.448  0644 00000007.zfs
- 2022-12-17 19:54:16          30.108.136  0644 00000008.zfs
- 2022-12-17 21:26:30             210.184  0644 00000009.zfs
- 2022-12-17 22:06:24           6.137.928  0644 00000010.zfs
- 2022-12-18 09:00:00             323.152  0644 00000011.zfs
- 2022-12-19 09:00:00               6.912  0644 00000012.zfs
- 2022-12-20 09:00:00       4.593.426.672  0644 00000013.zfs
- 2022-12-21 09:00:00         159.435.888  0644 00000014.zfs
- 2022-12-22 09:00:00       4.579.140.520  0644 00000015.zfs
- 2022-12-24 20:01:41         193.543.496  0644 00000016.zfs
- 2022-12-24 20:07:14          48.853.728  0644 00000017.zfs
- 2022-12-24 20:50:13         101.397.072  0644 00000018.zfs
- 2022-12-24 21:00:10          67.582.368  0644 00000019.zfs
- 2022-12-24 21:01:16           4.119.336  0644 00000020.zfs
- 2022-12-25 09:00:46           4.500.720  0644 00000021.zfs
- 2022-12-26 09:00:46           4.212.928  0644 00000022.zfs
- 2022-12-27 09:00:45           4.212.928  0644 00000023.zfs
- 2022-12-27 18:26:30          31.078.416  0644 00000024.zfs
- 2022-12-28 09:00:46          12.765.240  0644 00000025.zfs
- 2022-12-28 14:20:46         267.543.808  0644 00000026.zfs
- 2022-12-28 15:20:46           5.191.048  0644 00000027.zfs
- 2022-12-28 16:20:45           5.276.752  0644 00000028.zfs
- 2022-12-28 17:20:46           5.129.040  0644 00000029.zfs
- 2022-12-28 18:13:36           1.186.440  0644 00000030.zfs
- 2022-12-28 18:20:46           4.976.368  0644 00000031.zfs
- 2022-12-28 18:48:01             512.168  0644 00000032.zfs
- 2022-12-28 19:20:46             659.400  0644 00000033.zfs
- 2022-12-28 20:20:46           1.011.792  0644 00000034.zfs
- 2022-12-28 21:20:46             853.056  0644 00000035.zfs
- 2022-12-28 22:20:46             457.088  0644 00000036.zfs
- 2022-12-29 09:20:47             547.144  0644 00000037.zfs
- 2022-12-29 10:20:46           1.693.664  0644 00000038.zfs
- 2022-12-29 11:20:46           7.812.888  0644 00000039.zfs
- 2022-12-29 12:20:46          47.081.880  0644 00000040.zfs
- 2022-12-29 13:17:53           6.835.400  0644 00000041.zfs
- 2022-12-29 13:20:46               2.976  0644 00000042.zfs
- 2022-12-29 13:25:35              43.120  0644 00000043.zfs
- 2022-12-29 14:20:46           3.005.312  0644 00000044.zfs
- 2022-12-29 15:20:46           7.536.880  0644 00000045.zfs
- 2022-12-29 16:20:47           3.105.112  0644 00000046.zfs
- 2022-12-29 17:20:46           5.992.704  0644 00000047.zfs
- 2022-12-29 18:20:46          16.974.792  0644 00000048.zfs
- 2022-12-29 19:20:46           1.865.736  0644 00000049.zfs
- 2022-12-29 20:20:46           1.671.704  0644 00000050.zfs
- 2022-12-29 21:20:46           1.797.704  0644 00000051.zfs
- 2022-12-29 22:20:46             791.176  0644 00000052.zfs
- 2022-12-30 09:20:47             599.128  0644 00000053.zfs
- 2022-12-30 10:20:46           2.978.392  0644 00000054.zfs
- 2022-12-30 11:20:46           3.004.200  0644 00000055.zfs
- 2022-12-30 12:20:46          46.262.752  0644 00000056.zfs
- 2022-12-30 13:20:46           4.478.584  0644 00000057.zfs
- 2022-12-30 14:20:46           1.442.768  0644 00000058.zfs
- 2022-12-30 15:20:46          11.723.952  0644 00000059.zfs
- 2022-12-30 16:20:47           1.931.920  0644 00000060.zfs
- 2022-12-30 17:20:46             813.392  0644 00000061.zfs
- 2022-12-30 18:20:46           1.373.176  0644 00000062.zfs
- 2022-12-30 18:22:14               2.976  0644 00000063.zfs
- 2022-12-30 19:14:54             118.504  0644 00000064.zfs
- 2022-12-30 19:20:46              49.264  0644 00000065.zfs
- 2022-12-30 20:20:46             575.152  0644 00000066.zfs
- 2022-12-30 21:20:46             437.016  0644 00000067.zfs
- 2022-12-30 22:20:46             571.880  0644 00000068.zfs
- 2022-12-31 09:20:46             730.168  0644 00000069.zfs
- 2022-12-31 10:20:46               2.976  0644 00000070.zfs
- 2022-12-31 11:20:46               2.976  0644 00000071.zfs
- 2022-12-31 12:20:46               2.976  0644 00000072.zfs

       82.795.178.655 (77.11 GB) of 82.795.178.655 (77.11 GB) in 111 files shown
       67.417.370.407 compressed

0.344 seconds (00:00:00) (all OK)

Every .zfs is a (incremental) snapshot stored into a single archive
Code:
31/12/2022  11:26    67.417.370.407 incrementale.zpaq
 

fcorbelli

Explorer
Joined
Dec 29, 2022
Messages
68
In this example (filesystem-based, not zfs-send) there are 876 snapshots (version) into a single archive

Code:
876 versions, 134.072 files, 860.170 fragments, 9.112 blocks, 47.698.860.801 bytes (44.42 GB)
-------------------------------------------------------------------------
< Ver  > <  date  > < time >  < added > <removed>    <    bytes added   >
-------------------------------------------------------------------------
00000001 2022-10-12 20:45:21  +00104471 -00000000 ->       42.890.734.003
00000002 2022-10-12 21:29:11  +00000001 -00000000 ->                8.484
00000003 2022-10-12 21:31:36  +00000005 -00000000 ->              177.284
00000004 2022-10-13 08:30:00  +00000001 -00000000 ->              116.036
00000005 2022-10-13 09:30:00  +00000018 -00000000 ->            3.366.718
00000006 2022-10-13 10:30:00  +00000013 -00000000 ->            2.438.487
00000007 2022-10-13 11:30:00  +00000012 -00000005 ->            9.083.038
00000008 2022-10-13 11:59:11  +00000013 -00000001 ->            8.620.275
00000009 2022-10-13 12:30:00  +00000015 -00000000 ->              839.294
00000010 2022-10-13 13:30:00  +00000014 -00000000 ->            2.317.836
00000011 2022-10-13 14:30:00  +00000011 -00000000 ->              840.239
00000012 2022-10-13 15:30:00  +00000006 -00000000 ->              965.246
(...)
00000013 2022-10-13 16:30:00  +00000026 -00000001 ->            8.672.292
00000014 2022-10-13 17:30:00  +00000032 -00000000 ->           24.162.221
00000015 2022-10-13 18:30:00  +00000024 -00000001 ->              720.356
00000016 2022-10-13 19:30:00  +00000113 -00000003 ->            1.653.739
00000017 2022-10-13 20:30:00  +00000023 -00000001 ->            3.085.008
00000018 2022-10-14 08:30:00  +00000005 -00000000 ->               83.545
00000019 2022-10-14 09:30:00  +00000012 -00000000 ->              545.863
00000020 2022-10-14 10:30:00  +00000015 -00000002 ->            1.281.528
00000021 2022-10-14 11:30:00  +00000012 -00000000 ->            8.823.876
00000022 2022-10-14 12:30:00  +00000024 -00000000 ->            9.248.224
00000023 2022-10-14 13:30:00  +00000035 -00000005 ->            2.007.169
00000024 2022-10-14 14:30:00  +00000014 -00000002 ->            2.101.444
00000025 2022-10-14 15:30:00  +00000005 -00000000 ->              307.396
00000026 2022-10-14 16:30:00  +00000092 -00000079 ->              912.588
00000027 2022-10-14 17:30:00  +00000016 -00000000 ->              683.048
00000028 2022-10-14 18:30:00  +00000019 -00000001 ->              324.837
00000029 2022-10-14 19:30:00  +00000016 -00000000 ->              977.845
(...)
00000283 2022-11-07 14:30:00  +00000008 -00000000 ->              969.360
00000284 2022-11-07 15:30:00  +00000004 -00000000 ->              184.861
00000285 2022-11-07 16:30:00  +00000013 -00000000 ->              545.258
00000286 2022-11-07 17:30:00  +00000011 -00000000 ->              153.778
00000287 2022-11-07 18:30:00  +00000017 -00000002 ->              294.551
00000288 2022-11-07 19:30:00  +00000015 -00000004 ->              578.558
00000289 2022-11-07 20:30:00  +00000011 -00000002 ->              676.305
00000290 2022-11-08 08:30:00  +00000007 -00000000 ->              278.151
00000291 2022-11-08 09:30:00  +00000008 -00000000 ->            1.315.940
00000292 2022-11-08 10:30:00  +00000102 -00000086 ->            1.284.043
(...)
00000336 2022-11-11 15:30:00  +00000012 -00000000 ->              499.249
00000337 2022-11-11 16:30:00  +00000016 -00000000 ->            1.401.665
00000338 2022-11-11 17:30:00  +00000026 -00000012 ->            4.974.511
00000339 2022-11-11 18:30:00  +00000517 -00000492 ->            5.931.620
00000340 2022-11-11 19:30:00  +00000018 -00000006 ->            1.121.412
00000341 2022-11-11 20:30:00  +00000005 -00000001 ->              126.336
(...)
00000354 2022-11-14 10:30:00  +00000093 -00000073 ->            2.624.315
00000355 2022-11-14 11:30:00  +00000165 -00000009 ->          155.338.266
00000356 2022-11-14 12:30:00  +00000023 -00000000 ->            3.375.672
00000357 2022-11-14 13:30:00  +00000020 -00000000 ->            1.306.594
(...)
00000358 2022-11-14 14:30:00  +00000016 -00000003 ->              776.622
00000359 2022-11-14 15:30:00  +00000011 -00000001 ->              688.356
00000360 2022-11-14 16:30:00  +00000024 -00000040 ->              583.031
00000361 2022-11-14 17:30:00  +00000038 -00000006 ->           31.143.637
00000362 2022-11-14 18:30:00  +00000015 -00000001 ->            1.434.625
00000363 2022-11-14 19:30:00  +00000014 -00000000 ->           11.497.122
00000364 2022-11-14 20:30:00  +00000011 -00000002 ->              350.530
(...)
00000383 2022-11-16 13:30:00  +00000014 -00000001 ->              487.892
00000384 2022-11-16 14:30:00  +00000013 -00000000 ->              951.144
00000385 2022-11-16 15:30:00  +00000009 -00000001 ->            2.206.393
00000386 2022-11-16 16:30:00  +00000023 -00000000 ->            2.933.378
00000387 2022-11-16 17:30:00  +00000033 -00000005 ->            2.751.328
00000388 2022-11-16 18:30:00  +00000028 -00000001 ->            1.508.851
00000389 2022-11-16 19:30:00  +00000018 -00000001 ->           43.953.285
00000390 2022-11-16 20:30:00  +00000009 -00000000 ->              836.349
00000391 2022-11-17 08:30:00  +00000006 -00000000 ->              113.361
00000392 2022-11-17 09:30:00  +00000009 -00000000 ->              377.362
(...)
00000420 2022-11-20 17:30:00  +00000005 -00000000 ->               46.285
00000421 2022-11-20 18:30:00  +00000014 -00000001 ->              735.535
00000422 2022-11-20 19:30:00  +00000010 -00000000 ->              246.363
00000423 2022-11-20 20:30:00  +00000006 -00000000 ->               46.661
00000424 2022-11-21 08:30:00  +00000004 -00000001 ->               28.427
00000425 2022-11-21 09:30:00  +00000013 -00000000 ->            1.289.597
00000426 2022-11-21 10:30:00  +00000322 -00000304 ->              698.766
00000427 2022-11-21 11:30:00  +00000201 -00000168 ->              737.515
(...)
00000453 2022-11-23 11:30:00  +00000012 -00000000 ->              309.172
00000454 2022-11-23 12:30:00  +00000015 -00000002 ->            4.582.153
00000455 2022-11-23 13:30:00  +00000013 -00000000 ->            1.566.619
00000456 2022-11-23 14:30:00  +00000010 -00000001 ->            5.292.603
00000457 2022-11-23 15:30:00  +00000009 -00000000 ->              782.036
00000458 2022-11-23 16:30:00  +00000017 -00000003 ->            6.729.256
00000459 2022-11-23 17:30:00  +00000016 -00000001 ->            2.270.267
00000460 2022-11-23 18:30:00  +00000011 -00000001 ->              700.114
00000461 2022-11-23 19:30:00  +00000014 -00000001 ->              373.737
(...)
00000489 2022-11-26 08:30:00  +00000004 -00000000 ->           18.516.577
00000490 2022-11-26 10:30:00  +00000008 -00000000 ->              759.870
00000491 2022-11-26 11:30:00  +00000013 -00000001 ->           15.521.641
00000492 2022-11-26 12:30:00  +00000010 -00000001 ->              480.441
00000493 2022-11-26 13:30:00  +00000009 -00000000 ->              260.889
00000494 2022-11-26 14:30:00  +00000012 -00000001 ->              716.927
00000495 2022-11-26 15:30:00  +00000001 -00000000 ->                  590
00000496 2022-11-26 16:30:00  +00000005 -00000000 ->               54.298
00000497 2022-11-26 17:30:00  +00000007 -00000001 ->              218.955
(...)
00000554 2022-12-02 10:30:00  +00000020 -00000000 ->           14.655.969
00000555 2022-12-02 11:30:00  +00000051 -00000034 ->           11.518.349
00000556 2022-12-02 12:30:00  +00000013 -00000001 ->              282.478
00000557 2022-12-02 13:30:00  +00000010 -00000001 ->            4.044.904
00000558 2022-12-02 14:30:00  +00000014 -00000000 ->           67.126.655
00000559 2022-12-02 15:30:00  +00000019 -00000004 ->            1.764.754
00000560 2022-12-02 16:30:00  +00000022 -00000000 ->           26.196.793
00000561 2022-12-02 17:30:00  +00000018 -00000000 ->              918.455
00000562 2022-12-02 18:30:00  +00000018 -00000003 ->            2.166.215
00000563 2022-12-02 19:30:00  +00000022 -00000000 ->           30.417.568
00000564 2022-12-02 20:30:00  +00000011 -00000005 ->              322.692
00000565 2022-12-03 08:30:00  +00000012 -00000000 ->              642.657
00000566 2022-12-03 10:30:00  +00000006 -00000000 ->              879.064
00000567 2022-12-03 11:30:00  +00000006 -00000000 ->              366.996
(...)
00000625 2022-12-08 17:30:00  +00000002 -00000000 ->               11.206
(...)
00000698 2022-12-14 20:30:00  +00000010 -00000000 ->            1.190.623
00000699 2022-12-15 08:30:00  +00000008 -00000000 ->               71.569
00000700 2022-12-15 09:30:00  +00000012 -00000000 ->              726.957
00000701 2022-12-15 10:30:00  +00000013 -00000003 ->              249.967
00000702 2022-12-15 11:30:00  +00000017 -00000001 ->            1.086.552
00000703 2022-12-15 12:30:00  +00001288 -00000002 ->          306.886.265
00000704 2022-12-15 13:30:00  +00000015 -00000002 ->           15.724.173
00000705 2022-12-15 14:30:00  +00000013 -00000001 ->            4.914.924
00000706 2022-12-15 15:30:00  +00000014 -00000000 ->              492.424
(...)
00000764 2022-12-20 20:30:00  +00000007 -00000000 ->              311.220
00000765 2022-12-21 08:30:00  +00000013 -00000000 ->            2.013.266
00000766 2022-12-21 09:30:00  +00000016 -00000001 ->            9.363.022
00000767 2022-12-21 10:30:00  +00000008 -00000000 ->            1.252.542
00000768 2022-12-21 11:30:00  +00000044 -00000036 ->            1.182.781
00000769 2022-12-21 12:30:00  +00000066 -00000008 ->           34.995.521
00000770 2022-12-21 13:30:00  +00000028 -00000013 ->           29.262.652
00000771 2022-12-21 14:30:00  +00000013 -00000006 ->           42.989.060
00000772 2022-12-21 15:30:00  +00000014 -00000000 ->            2.377.864
00000773 2022-12-21 16:30:00  +00000016 -00000000 ->            8.834.052
(...)
(...)
00000792 2022-12-23 09:30:00  +00000011 -00000000 ->            8.399.697
00000793 2022-12-23 10:30:00  +00000013 -00000000 ->            2.576.540
00000794 2022-12-23 11:30:00  +00000011 -00000002 ->            2.717.233
00000795 2022-12-23 12:30:00  +00000132 -00000114 ->              660.526
00000796 2022-12-23 13:30:00  +00000011 -00000000 ->            1.005.151
00000797 2022-12-23 14:30:00  +00000014 -00000000 ->              603.239
00000798 2022-12-23 15:30:00  +00000011 -00000001 ->              418.249
00000799 2022-12-23 16:30:00  +00000015 -00000001 ->           15.322.701
(...)
00000809 2022-12-24 13:30:00  +00000003 -00000000 ->               59.988
00000810 2022-12-24 14:30:00  +00000002 -00000000 ->                4.209
00000811 2022-12-24 15:30:00  +00000003 -00000000 ->               61.406
00000812 2022-12-24 16:30:00  +00000004 -00000000 ->               28.944
00000813 2022-12-24 17:30:00  +00000001 -00000000 ->                  590
00000814 2022-12-24 18:30:00  +00000004 -00000000 ->              346.700
00000815 2022-12-24 19:30:00  +00000002 -00000000 ->                  635
00000816 2022-12-24 20:30:00  +00000004 -00000000 ->            4.049.574
00000817 2022-12-25 08:30:00  +00000006 -00000000 ->            4.274.022
00000818 2022-12-25 09:30:00  +00000001 -00000000 ->                  584
00000819 2022-12-26 08:30:00  +00000002 -00000000 ->            4.123.115
00000820 2022-12-26 09:30:00  +00000001 -00000000 ->                  584
(...)
00000864 2022-12-30 11:30:00  +00000123 -00000030 ->           14.540.633
00000865 2022-12-30 12:30:00  +00000012 -00000000 ->              543.315
00000866 2022-12-30 13:30:00  +00000010 -00000001 ->              383.257
00000867 2022-12-30 14:30:00  +00000011 -00000000 ->              815.678
00000868 2022-12-30 15:30:00  +00000014 -00000001 ->              632.311
00000869 2022-12-30 16:30:00  +00000005 -00000000 ->               35.363
00000870 2022-12-30 17:30:00  +00000009 -00000000 ->              341.312
00000871 2022-12-30 18:30:00  +00000003 -00000000 ->                7.693
00000872 2022-12-30 19:30:00  +00000005 -00000000 ->               33.870
00000873 2022-12-30 20:30:00  +00000005 -00000000 ->               53.802
00000874 2022-12-31 08:30:00  +00000006 -00000000 ->               77.012
00000875 2022-12-31 09:30:00  +00000001 -00000000 ->                  593
00000876 2022-12-31 10:30:00  +00000001 -00000000 ->                  593

4.343 seconds (000:00:04) (all OK)
 

fcorbelli

Explorer
Joined
Dec 29, 2022
Messages
68
Of course on TrueNAS a good starting point is compiling from source (...just in case...) then run the executable (into or outside jail, as you like)
  • make a jail (ex. 13.1), do not forget to activate jail_zfs in Custom Properties (I think this is mandatory to try zfssomething)
  • (install the compiler and the "downloader")
  • pkg install -y llvm wget
  • (create and enter into project folder)
  • mkdir zp
  • cd zp
  • (download from github)
  • wget "https://github.com/fcorbelli/zpaqfranz/blob/main/zpaqfranz.cpp?raw=true" -O zpaqfranz.cpp
  • (inspect if you like the zpaqfranz.cpp)
  • (compile on Unix (-Dunix), with optimizations (-O3) the zpaqfranz.cpp into (-o) zpaqfranz, with pthread library and statically linked)
  • clang++ -Dunix -O3 zpaqfranz.cpp -o zpaqfranz -pthread -static
    I don't know how to allow the jail to take snapshots though, maybe with jail_zfs_dataset and jail_zfs_mountpoint? I really do not know (yet).
Now ./zpaqfranz, ./zpaqfranz h, ./zpaqfranz h h etc

For "escaping" from jail (suggestion: don't do on production systems, unless you know what you are doing!) upload the zpaqfranz just compiled "somewhere" (ex. by ftp), then (on the "real" TrueNAS, outside the jail) download and put into (as usual) /usr/local/bin

For a non-zfs run with the "old" version, just
  • make a jail
  • pkg install zpaqfranz
  • have fun
 

fcorbelli

Explorer
Joined
Dec 29, 2022
Messages
68
Quick "recap" of zfs commands (with examples)
Do not forget double quote!

List all snapshots
Code:
zpaqfranz zfslist "*" 


List only syncoid (if any)
Code:
zpaqfranz zfslist "*" "syncoid"


List only "zpaqfranz" something on tank/d (if any)
Code:
zpaqfranz zfslist "tank/d" "zpaqfranz"
 

fcorbelli

Explorer
Joined
Dec 29, 2022
Messages
68
Get the destroy command (not runned, you must copy-paste from console, or from a script!)
It is safe (dry run). Please do not destroy something useful! From great power came great...double check :)

... the same as list...

Prepare "destroy" for every snapshot ending with --7d (zfSnap for example)
Code:
zpaqfranz zfspurge "*" "--7d"
 
Last edited:

fcorbelli

Explorer
Joined
Dec 29, 2022
Messages
68
Freeze multiple snapshot inside a single archive (lengthy!)
All snapshots starting with "tank/d@2021" and ending with "--60d" will be (deduplicated and compressed) into the /temporaneo/kongo60.zpaq file

This is a file-level archiving, NOT a zfs send

Code:
zpaqfranz zfsadd "tank/d@2021" "--60d" "/temporaneo/kongo60.zpaq"
 
Last edited:

fcorbelli

Explorer
Joined
Dec 29, 2022
Messages
68
Archiving incremental-zfs-send taking only the latest snapshot of dataset tank/something into file /temporaneo/incrementale.zpaq. First run slow, the others much faster

THIS is the feature I'd like to get help on, suggestions, bugs, etc


The -kill will destroy old snapshots (to save space). Remove if you want to keep every zpaqfranz00000001... zpaqfranz00000002...

Code:
zpaqfranz zfsbackup  /temporaneo/incrementale.zpaq tank/something -kill
 
Last edited:

fcorbelli

Explorer
Joined
Dec 29, 2022
Messages
68
Extracting all .zfs files from archive /temporaneo/incrementale into /restoredzfsfolder

Code:
zpaqfranz x /temporaneo/incrementale.zpaq -to /restoredzfsfolder


Create thescript.sh to restoring every .zfs file into /restorefdzfsfolder into rpool/restored with name mymark00...
Code:
zpaqfranz zfsrestore /restoredzfsfolder rpool/restored -out thescript.sh -to mymark


You must run thescript.sh (or whatever) yourself (just to double-check)
 

fcorbelli

Explorer
Joined
Dec 29, 2022
Messages
68
Direct restore from archive /tmp/ordinato.zpaq (created by zpaqfranz zfsbackup!) into new dataset rpool/restored via thescript.sh

Code:
zpaqfranz zfsreceive /tmp/ordinato.zpaq rpool/restored -out thescript.sh

You must run thescript.sh (or whatever) yourself (just to double-check)
 

fcorbelli

Explorer
Joined
Dec 29, 2022
Messages
68
Please note that the zfs-something command DOES NOT HAVE (yet) input checks
Triple check before doing restore-receive (do NOT use production-servers!!!)

Therefore, please
- do not backup not existent dataset
- do not try to restore on existent dataset
- do not pass tar.gz instead of .zpaq archive
- do not try "strange" pool names (like "CNBe $$LN/"@@\Pippo") or whatever
- do not "fake" a dataset
- do not make "YOURS" zpaqfranz000... snapshots

etc.etc.
 
Top