framps / raspiBackup

Create and keep multiple backup versions of your running Raspberries
https://raspibackup.linux-tips-and-tricks.de
GNU General Public License v3.0
815 stars 75 forks source link

Include the OS release info in backup directory names #780

Closed rpi-simonz closed 2 weeks ago

rpi-simonz commented 1 month ago

Adding to issue #778 this is my attempt implementing a different naming scheme of the backup directories which includes the OS version.

Using

raspberrypi@debian12-rsync-backup-20240416-094106

instead of

raspberrypi-rsync-backup-20240416-094106

This way every time a new OS version is saved a new backup directory is created/used and thus a new full backup is created.

Possibly already existing backups with the old name (without OS release info) are simply ignored during smartRecycle and while checking the number of backups to keep.

I successfully tested backup and restore in different configurations.

rpi-simonz commented 1 month ago

Regarding this ...

Possibly already existing backups with the old name (without OS release info) are simply ignored during smartRecycle and while checking the number of backups to keep.

... I'll check the other possible option: including the old ones.

Probably tomorrow. Stay tuned.

framps commented 1 month ago

Appreciate this PR. It's very useful to include the OS release in the backup path name.

Unfortunately I'm busy testing the next release 0.7.0 and therefore don't accept the PR as of now. Please be patient. I'll accept the PR when I finished my tests for next release and then add this nice PR

rpi-simonz commented 1 month ago

I'm still working on some implementation details of this PR. So it's a perfect fit that you are busy elsewhere for some time! ;-)

rpi-simonz commented 1 month ago

It's done. As far as I can tell... (Edit-1: ROFL! It's never done!)

The old backups without OS release info in its name are re-included into recycling strategy again.

But considering the current discussion in https://forum-raspberrypi.de regarding partitionbased backups and their handling during recycling it might be an idea to

Of course that's another story.

Edit-2: In the meantime the strategy has been changed. Old-type backups are old backups. Let them alone!

rpi-simonz commented 1 month ago

So, since in the meantime the strategy had been changed (again) it's now like this:

Old-type backups (without OS-release info in its name) are old backups. They are not touched/deleted/recycled automatically.

But there is a - hopefully - clear message for the user about them: They can be deleted manually.

I used and created new MSG_ messages for writeToConsole as good as I could. Probably the numbering has to be adapted - I didn't know your preferences there.

framps commented 1 month ago

But there is a - hopefully - clear message for the user about them: They can be deleted manually.

I frankly thought to document this but usually docs are not read - so it's a very good idea to write a message to inform about this change.

Probably the numbering has to be adapted - I didn't know your preferences there.

No worries - I also have added some new messages. Message numbers can be updated very easy :wink:

rpi-simonz commented 1 month ago

I enhanced the message about the directory name change by referring to a raspiBackup version number. Of course that number needs to be checked again on implementation.

rpi-simonz commented 1 month ago

Commit 778ffc6 (Fix some indentation inconsistencies) above isn't exactly related to this topic here. But it slipped in...

framps commented 1 month ago

Please update raspiBackup7412Test.sh in the test directory to use the new backup directory name.

Don't fiddle with the tests :exclamation: . It created a lot of headache to create them and I don't want you to get the same headache :wink: .

Just make sure they succeed with the new backup directory name. Would be great if you can make the test to run also on another more powerful Linux system. I executed this test on my desktop instead of a Raspberry.

rpi-simonz commented 1 month ago

At least raspiBackup7412Test.sh is running now - without complaints. But I'm not sure whether I have done it completely right. The directory handling isn't easy to understand there. See the TODOs.

For now I won't continue with that test script. Other parts seem to be more important.

framps commented 1 month ago

That's what I expected: You had to update the directory name only and not to change anything in the test logic. I agree it's complicated code. But the test now finishes again successfully and that's important because you updated the SR code and we have to make sure the SR code still works correctly :wink:

framps commented 1 week ago

Code now rebased into development branch