fcorbelli / zpaqfranz

Deduplicating archiver with encryption and paranoid-level tests. Swiss army knife for the serious backup and disaster recovery manager. Ransomware neutralizer. Win/Linux/Unix
MIT License
281 stars 25 forks source link

Renaming multipart backup files #150

Open Erol-2022 opened 3 days ago

Erol-2022 commented 3 days ago

Hello,

Let's assume that we are employing a batch file to make multipart backups :

zpaqfranz backup C:\backuparchive.zpaq C:\Source

After a certain time, consolidating the multipart archive :

C:\>zpaqfranz.exe consolidate C:\backuparchive.zpaq -to Consolidated.zpaq -space

The old and new backup files could look like the following :

backuparchive_00000000_backup.index
backuparchive_00000000_backup.txt
backuparchive_00000001.zpaq
backuparchive_00000002.zpaq
Consolidated_00000000_backup.index
Consolidated_00000000_backup.txt
Consolidated_00000001.zpaq

Deleting the old backuparchive file set is eeasy : del backuparchive.

Is it possible to add an option to zpaqfranaz to rename the "Consolidated" files to the original "backuparchive" ?

I guess renaming manually the "Consolidated" files is not enough as there are references to the current symbol "Consolidated"

The purpose is to keep intact the original batch file above to maintain a continuous backup process.

fcorbelli commented 3 days ago

It's difficult to do because you might keep the files in the same folder. If they were in different folders, they could have the same name. You just need to change the file name inside the .txt file.

For example backup due

$zpaqfranz backupfile|2|2024-11-28 21:09:54|MD5|z:/due_00000001.zpaq
6245b6b314aeb873e37d617ff7c6f9d8 |[        1.595.891.806] <39A03CCA0D7D8796> $2024-11-28 21:09:54$ z:/due_00000001.zpaq

To tre should become

$zpaqfranz backupfile|2|2024-11-28 21:09:54|MD5|z:/tre_00000001.zpaq
6245b6b314aeb873e37d617ff7c6f9d8 |[        1.595.891.806] <39A03CCA0D7D8796> $2024-11-28 21:09:54$ z:/tre_00000001.zpaq
Erol-2022 commented 3 days ago

Hello Mr.Corbelli,

Many thanks, this one works :

busybox64.exe sed -i "s/Consolidated/backuparchive/g" Consolidated_00000000_backup.txt

Following the busybox operation, I renamed the multipart backup files to "backuparchive"

fcorbelli commented 2 days ago

60_10j.zip You can try the (not tested) pre-release with -destination, with rename

zpaqfranz consolidate /tmp/theold.zpaq -destination /tmp/renamed.zpaq

and rename-copy

zpaqfranz consolidate /tmp/theold.zpaq  -destination /backup/somewhere_already_present/thebrandnew.zpaq

(the difference is in the output path)

No test for errors (like rename to himself, use only fullpath (not relative) etc)

Erol-2022 commented 1 day ago

Hi Mr. Corbelli,

Thanks for your efforts. I managed to compile the code with Msys2 :

g++ -m64 -O3 zpaqfranz.cpp -o zpaqfranz64 -pthread -static -lurlmon

Testing the first option to rename the "Consolidated" archive :

C:\>zpaqfranz64 consolidate C:\Consolidated.zpaq -destination C:\Backuparchive.zpaq
zpaqfranz v60.10j-JIT,-GUI,-L,HW SHA1/2,4,SFX64 v55.1,(2024-11-29)
franz:consolidate                               Y - command
franz:-destination          C:/Backuparchive.zpaq 0
franz:-noconsole
Renaming to -destination <<C:/Backuparchive.zpaq>>
Copy-Rename .index <<C:/Consolidated_00000000_backup.index>> => <<C:/Backuparchive_00000000_backup.index>> :OK
Copy-Rename <<c:/consolidated_00000001.zpaq>> => <<c:/consolidated_00000001.zpaq>> :OK
0.062s (00:00:00,52.48KB) (all OK)

Only the index file is renamed :

Backuparchive_00000000_backup.index
Consolidated_00000000_backup.txt
consolidated_00000001.zpaq
fcorbelli commented 1 day ago

I'll check in the afternoon, more developing is needed

fcorbelli commented 19 hours ago
C:\zpaqfranz>zpaqfranzhw backup z:\test c:\nz -silent

C:\zpaqfranz>zpaqfranzhw backup z:\test c:\1200 -silent

C:\zpaqfranz>dir z:
 Il volume nell'unità Z è RamDisk
 Numero di serie del volume: 0C82-1B18

 Directory di Z:\

01/12/2024  14:15         1.855.614 test_00000000_backup.index
01/12/2024  14:15               316 test_00000000_backup.txt
01/12/2024  14:14       920.718.464 test_00000001.zpaq
01/12/2024  14:15     1.429.352.920 test_00000002.zpaq
               4 File  2.351.927.314 byte
zpaqfranz consolidate z:\test.zpaq -to z:\consolidated.zpaq -silent
C:\zpaqfranz>dir z:\
 Il volume nell'unità Z è RamDisk
 Numero di serie del volume: 0C82-1B18

 Directory di z:\

01/12/2024  14:15         1.855.614 consolidated_00000000_backup.index
01/12/2024  14:15               208 consolidated_00000000_backup.txt
01/12/2024  14:15     2.350.071.384 consolidated_00000001.zpaq
01/12/2024  14:15         1.855.614 test_00000000_backup.index
01/12/2024  14:15               316 test_00000000_backup.txt
01/12/2024  14:14       920.718.464 test_00000001.zpaq
01/12/2024  14:15     1.429.352.920 test_00000002.zpaq

Finally

C:\zpaqfranz>zpaqfranz consolidate z:\consolidated.zpaq -destination z:\backuparchive.zpaq -silent

C:\zpaqfranz>dir z:\
 Il volume nell'unità Z è RamDisk
 Numero di serie del volume: 0C82-1B18

 Directory di z:\

01/12/2024  14:15         1.855.614 backuparchive_00000000_backup.index
01/12/2024  14:17               210 backuparchive_00000000_backup.txt
01/12/2024  14:15     2.350.071.384 backuparchive_00000001.zpaq
01/12/2024  14:15               208 consolidated_00000000_backup.txt
01/12/2024  14:15         1.855.614 test_00000000_backup.index
01/12/2024  14:15               316 test_00000000_backup.txt
01/12/2024  14:14       920.718.464 test_00000001.zpaq
01/12/2024  14:15     1.429.352.920 test_00000002.zpaq

It is hard to delete the dangling old _backup.txt

fcorbelli commented 19 hours ago
C:\zpaqfranz>zpaqfranz testbackup z:\backuparchive -verify
zpaqfranz v60.10j-JIT,-GUI,-L,HW BLAKE3,SHA1/2,4,SFX64 v55.1,(2024-11-29)
franz:testbackup                                _ - command
franz:-hw -verify
====================================================================================================
Loading backupfile... z:/backuparchive_00000000_backup.txt
Rows in backup 00000001 from 00000001 to 00000001

Now FULL hash check

GLOBAL SHA256: 427B8487743B2B4DF663A09C1D7CC32336BE2DB2D6D0D33A301751FE221622B7
Chunks checked OK: 1 (2.350.071.384 @ 1.022.659.436/s)
Last date 2024-12-01 14:15:46
2.313s (00:00:02,4.52KB) (all OK)