Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

omv-backup - option "keep the last x days" not working #19

Closed
nexusle opened this issue Jan 21, 2019 · 18 comments
Closed

omv-backup - option "keep the last x days" not working #19

nexusle opened this issue Jan 21, 2019 · 18 comments

Comments

@nexusle
Copy link

nexusle commented Jan 21, 2019

Hi,

I use openmediavault-backup from omv-extras.org to backup my OMV system partition (DD method). I've setup to hold backups from the last 3 days. This seems not to work. I see backups of 5 days 17 - 21 january). Backups of 2 days weren't deleted.

@ryecoaaron
Copy link
Member

Are you using version 4.0.5? I fixed this a few weeks ago - 468c469

@nexusle
Copy link
Author

nexusle commented Jan 21, 2019

Yes. 4.0.5. I see no other versions in the plugin section

@ryecoaaron
Copy link
Member

Unfortunately, the plugin tab saying 4.0.5 doesn't necessarily mean you are using 4.0.5 since only one version shows up in that list. It could mean it is available. What is the output of: dpkg -l | grep openm

@nexusle
Copy link
Author

nexusle commented Jan 21, 2019

Also 4.0.5

@nexusle
Copy link
Author

nexusle commented Jan 21, 2019

I think some files from old days were deleted and some not. Unfortunately I deleted the old files today so I can not say, which files were deleted by plugin and which files not. But I can say, that the DD image files was not deleted.

@ryecoaaron
Copy link
Member

The plugin is a using a find command with the mtime and delete flags. I don't know how this would be wrong unless something on your system is changing the modified time. I would like to see an ls -al of the directory when there is more than the set number of days. You could also change to the directory and do a find . -maxdepth 1 -type f -mtime +3 -name "backup-omv*" to see what it would delete.

When I run this command on my system, January 17th backups are still there. If I change it to 2 days, only the January 17th backups are deleted. So, everything is working as expected when using find.

@nexusle
Copy link
Author

nexusle commented Jan 21, 2019

This is the output of ls -la:

-rw-rw-rw-+ 1 root users 726 Jan 19 00:00 backup-omv-19-Jan-2019_00-00-01.blkid
-rw-rw-rw-+ 1 root users 37173614128 Jan 19 00:41 backup-omv-19-Jan-2019_00-00-01.dd.gz
-rw-rw-rw-+ 1 root users 516 Jan 19 00:00 backup-omv-19-Jan-2019_00-00-01.fdisk
-rw-rw-rw-+ 1 root users 446 Jan 19 00:00 backup-omv-19-Jan-2019_00-00-01.grub
-rw-rw-rw-+ 1 root users 512 Jan 19 00:00 backup-omv-19-Jan-2019_00-00-01.grubparts
-rw-rw-rw-+ 1 root users 2543 Jan 19 00:00 backup-omv-19-Jan-2019_00-00-01.packages
-rw-rw-rw-+ 1 root users 726 Jan 20 00:00 backup-omv-20-Jan-2019_00-00-02.blkid
-rw-rw-rw-+ 1 root users 36877644437 Jan 20 00:41 backup-omv-20-Jan-2019_00-00-02.dd.gz
-rw-rw-rw-+ 1 root users 516 Jan 20 00:00 backup-omv-20-Jan-2019_00-00-02.fdisk
-rw-rw-rw-+ 1 root users 446 Jan 20 00:00 backup-omv-20-Jan-2019_00-00-02.grub
-rw-rw-rw-+ 1 root users 512 Jan 20 00:00 backup-omv-20-Jan-2019_00-00-02.grubparts
-rw-rw-rw-+ 1 root users 2543 Jan 20 00:00 backup-omv-20-Jan-2019_00-00-02.packages
-rw-rw-rw-+ 1 root users 726 Jan 21 00:00 backup-omv-21-Jan-2019_00-00-01.blkid
-rw-rw-rw-+ 1 root users 36912065348 Jan 21 00:41 backup-omv-21-Jan-2019_00-00-01.dd.gz
-rw-rw-rw-+ 1 root users 516 Jan 21 00:00 backup-omv-21-Jan-2019_00-00-01.fdisk
-rw-rw-rw-+ 1 root users 446 Jan 21 00:00 backup-omv-21-Jan-2019_00-00-01.grub
-rw-rw-rw-+ 1 root users 512 Jan 21 00:00 backup-omv-21-Jan-2019_00-00-01.grubparts
-rw-rw-rw-+ 1 root users 2543 Jan 21 00:00 backup-omv-21-Jan-2019_00-00-01.packages

@nexusle
Copy link
Author

nexusle commented Jan 21, 2019

If I do a "find" with +1 (older files I'd deleted manually) then the 19th january files are shown, but I don't know, why it not work automatically. Is there a log I can check?

@ryecoaaron
Copy link
Member

+1 means 24 hours. Your backup on the 19th is the only one more than 24 hours old. So, I think it is working but you are thinking days where it is translated into hours and the oldest backup is technically within that time frame.

If it keeps the dd file and not the other files, it is because the last modified time for the dd image is 41 minutes after the other files. since this is a scheduled backup at midnight, the find command is run at 12:41 (after the backup). The non-dd files are outside of your 72 hour window where the dd file is still within it by 41 minutes.

If you want less backups, I would lower the number of days because I don't want to use something other than find in the plugin.

@nexusle
Copy link
Author

nexusle commented Jan 21, 2019

I looked in the "backup" script to try to reproduce the run...

where to find 'keep=$(omv_config_get "/config/system/backup/keep")'

On my OMV I have no "config" folder in system root... Maybe this is the problem to omv-backup not find the 'keep' variable?

@ryecoaaron
Copy link
Member

I guess I could "touch" all of the backup files for that run so they have the same timestamp.

What is the output of the following as root: omv-showkey backup
remove a password if you have one.

@ryecoaaron
Copy link
Member

ryecoaaron commented Jan 21, 2019

On my OMV I have no "config" folder in system root... Maybe this is the problem to omv-backup not find the 'keep' variable?

That isn't a folder. It is xml structure in /etc/openmediavault/config.xml. And trust me, if it wasn't finding your days, that would translate to zero and then it would never purge any backups.

@nexusle
Copy link
Author

nexusle commented Jan 21, 2019

+1 means 24 hours. Your backup on the 19th is the only one more than 24 hours old. So, I think it is working but you are thinking days where it is translated into hours and the oldest backup is technically within that time frame.

If it keeps the dd file and not the other files, it is because the last modified time for the dd image is 41 minutes after the other files. since this is a scheduled backup at midnight, the find command is run at 12:41 (after the backup). The non-dd files are outside of your 72 hour window where the dd file is still within it by 41 minutes.

If you want less backups, I would lower the number of days because I don't want to use something other than find in the plugin.

My oldest backup today morning was the 17th (the fifth day and the first update I've done). In sum this was 5 backups. I try now with setting "1" an will look, how many backups will deleted in a couple of days.

@nexusle
Copy link
Author

nexusle commented Jan 21, 2019

I guess I could "touch" all of the backup files for that run so they have the same timestamp.

What is the output of the following as root: omv-showkey backup
remove a password if you have one.

<backup>
  <sharedfolderref>a15536aa-bef3-4ec3-bd3e-c184b4405f94</sharedfolderref>
  <method>dd</method>
  <root></root>
  <extraoptions></extraoptions>
  <keep>3</keep>
  <passwd></passwd>
</backup>

@nexusle
Copy link
Author

nexusle commented Jan 21, 2019

And trust me, if it wasn't finding your days, that would translate to zero and then it would never purge any backups.

I believe we have a misunderstanding... My problem isn't, that backups are deleted, rather then they are not deleted after the period of days. I'll only keep 3 backups. Today morning I had 5 backkups, so 2 too much ;-)

@ryecoaaron
Copy link
Member

My oldest backup today morning was the 17th (the fifth day and the first update I've done). In sum this was 5 backups. I try now with setting "1" an will look, how many backups will deleted in a couple of days.

I believe we have a misunderstanding... My problem isn't, that backups are deleted, rather then they are not deleted after the period of days. I'll only keep 3 backups. Today morning I had 5 backkups, so 2 too much ;-)

No, it isn't five days. I understand what you are telling me but I don't think are understanding how find works. Look at this:
0 days - 12:41 on 01/21
1 day - 12:41 on 01/20
2 days - 12:41 on 01/19
3 days - 12:41 on 01/18
4 days - 12:41 on 01/17 and since the dd file isn't technically at 4 days yet (it is at 3 days 23 hours 19 minutes), it isn't deleted where the other files are at 4+ days since they are have the earlier timestamp.

Even if I changed the all the files modified times to the same time, you will still have four backups since the current backup is 0 days and the backup from 3 days ago isn't 4 days yet. So, find won't delete it.

@ryecoaaron
Copy link
Member

Your config looks right.

@nexusle
Copy link
Author

nexusle commented Jan 22, 2019

Good morning,

I checked the folder with setting "1" and now I have 2 backups, so it really works. Yesterday I was a little confused, that more backupd (days) exists, than I have setup. With Setting "1" I have backups of 2 days so I now choose "2" for 3 backups...

Thanks for your help and explanations yesterday.

@nexusle nexusle closed this as completed Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants