Scheduled backup fails to remove old backups

34 posts / 0 new
Last post
#1 Thu, 08/13/2009 - 05:13
mike65

Scheduled backup fails to remove old backups

Hello,

I'm having troubles with the setup I've created on a Virtualmin scheduled backup. It doesn't seem to be removing the backup directories of old backups I inform it to remove after X number of days. The email report states -

"Deleting backups older than 1 days .. .. no backups to delete were found"

Yet there's directories spanning many days there. If I set the scheduled backup to "Single archive file" with strftime on it removes those compressed files. But sadly it doesn't remove directories for some strange reason. I wish to use the newer "One file per server" backup format. The backups are being stored on the server itself for testing purposes until I can get it working.

The current setup I have is the following -

Local file or directory - /root/backup/%d-%m-%Y This names a newly created directory with the current date, several compressed files inside for each domain named "site1.tar.gz", "site2.tar.gz" for example.

Use strftime = yes

Transfer files after they've backed up = yes

Backup format - One file per server

Create destination directory = yes

Delete old backups after 1 day.

Any assistance in getting the system to remove old backup directories will be greatly appreciated.

Thu, 08/13/2009 - 11:45
JamieCameron

Virtualmin will delete old backup directories, but only if the dates on them are at least 1 day old. Note that it determines this by checking the actual last-modification times as shown by ls -l /root/backup, rather than the filenames.

If you list the /root/backup directory, do the dates on the sub-directories match up with their names? If not, perhaps something else is modifying them every day, and thus keeping Virtualmin from seeing them as old..

''

Sun, 09/13/2009 - 11:33
elsdon

drwxr-xr-x 2 bk bk 4096 Sep 9 00:52 09-09-2009 drwxr-xr-x 2 bk bk 4096 Sep 10 00:55 10-09-2009 drwxr-xr-x 2 bk bk 4096 Sep 11 00:48 11-09-2009 drwxr-xr-x 2 bk bk 4096 Sep 12 00:51 12-09-2009 drwxr-xr-x 2 bk bk 4096 Sep 13 00:39 13-09-2009

The dates on the directories look proper.. Mine is set to 3 days.. But it never seems to check it properly. It's becoming a problem as I'm having to manually clear it up or deal with exploded disks syndrome. EDS.

Sun, 09/13/2009 - 15:58
andreychek

How are you doing the backups? Are they being stored locally on your Virtualmin server? Or are they being stored remotely, via FTP or SSH or so?

-Eric

Sun, 09/13/2009 - 17:37
Acorp

I am having the same problem - Virtualmin will not delete any backups for me either. My setup is the same, down to the day - I have instructed Virtualmin to delete backups older than one day, and it is not. I am using "Delete backups older than 1 day" as well.

Eric, the OP said his backups are currently being stored locally on his server (as are mine):

The backups are being stored on the server itself for testing purposes until I can get it working.

Jamie, ls -l shows the correct dates on my backup directories as well.

Any thoughts?

  • Acorp

www.acorp.net

Sun, 09/13/2009 - 20:45 (Reply to #5)
JamieCameron

Hi Acorp,

What are you entering as the backup destination? Typically it should be something like :

/backup/%d-%m-%Y

which gets converted to the current date when the backup is run.

''

Mon, 09/14/2009 - 15:59 (Reply to #6)
Acorp

Backup Location:

/backups/virtualmin/Full-%d-%m-%Y

and for my incremental backups (which also aren't being purged):

/backups/virtualmin/Inc-%H-%d-%m-%Y

Thanks!

-Acorp

www.acorp.net

Mon, 09/14/2009 - 17:43 (Reply to #7)
JamieCameron

That looks OK.

I would be interested to see the output from the command :

ls -l /backups/virtualmin

''

Mon, 09/14/2009 - 20:32 (Reply to #8)
djdevin
[root@secure backup]# ls -al
total 24
drwxr-xr-x  5 root root 4096 Sep 14 00:00 .
drwxr-xr-x 22 root root 4096 Jul 17 15:43 ..
drwxr-xr-x  2 root root 4096 Sep 12 00:15 20090912
drwxr-xr-x  2 root root 4096 Sep 13 00:15 20090913
drwxr-xr-x  2 root root 4096 Sep 14 00:15 20090914
[root@secure backup]#

server set to delete after 1 day

Mon, 09/14/2009 - 22:55
elsdon

I am backing it up remotely to an FTP site. user/password/chmod all allow deletion, and when I FTP in with the same user/pass I can delete with no problems whatsoever.

Tue, 09/15/2009 - 00:05 (Reply to #10)
JamieCameron

Is this a Windows FTP server, or Linux?

''

Tue, 09/15/2009 - 13:51 (Reply to #11)
djdevin

linux here (centos 5.3)

Tue, 09/15/2009 - 15:08 (Reply to #12)
JamieCameron

Can the user Virtualmin is logging in via FTP as list the directory containing the backup sub-directories?

''

Wed, 09/16/2009 - 23:48 (Reply to #13)
djdevin

using a local directory here, no FTP

Sun, 10/04/2009 - 08:35
ChrisMoeller

hello jamie,

first I have to say, that vmin and wmin are a great work! Thanks for it. I love to use it since years . . .

I have the same problem backing up vservers in single files. After the correct time to delete the old backup folders, I get an error-mail which says, that the directories to delete haven't been empty. That is -in fact- correct, because the directories contain several (vserver-)tars. What do I have to do, that the ftp-client allows the deletion of (not empty) directories? They reside on a nas-system (D-LINK 323 aka conceptronics CHSNAS3) with built-in linux ftp-server. I fear, that I will not be able to configure its behavior.

Thank you in advance.

Chris

Mon, 04/11/2011 - 01:23
Seker

It took me a little bit to figure this out, but this can be caused by the Directory Listing Style being set to MS-DOS style in Information Internet Services (assuming you are using IIS for your FTP server). You have to change it to UNIX style for Virtualmin to read the dates properly.

P.S. Sorry for bumping an old thread, but it looks like it was never answered and this was the first page I found when searching.

Mon, 02/06/2012 - 20:32
kiteplans

Hi,

I am having the same problem. Remote backup via SSH - It all use to work fine, deleting old backups - and now for the last week it has stopped working? What could be causing this?

Anyone have any information?

Fri, 09/21/2012 - 12:02 (Reply to #17)
sonoracomm

Old backups not being deleted.

Not files, not directories.

Disk fills, further backups fail.

Happens with FTP (Linux, Centos 5) or local backups.

For local backups, I have pre and post commands to mount and dismount the backup filesystem.

Did anyone ever fix this? Or do I have to use a third-party backup solution?

Thanks,

G

Fri, 09/21/2012 - 12:14 (Reply to #18)
JamieCameron

If you have a post-backup command to immediately un-mount the backup filesystem, purging of old backups won't work as it is done after the post-backup command is run..

''

Fri, 09/21/2012 - 13:35 (Reply to #19)
sonoracomm

Hi Jaime, thanks for the rapid response!

Number one, that doesn't explain why it also happens on FTP and SSH backups.

Number two, I can't think of a reason why you would want the deletion to happen after the post script, though there probably is one...

Should I submit a bug report?

Thanks,

G

Fri, 09/21/2012 - 15:59 (Reply to #20)
JamieCameron

I see you filed bug https://www.virtualmin.com/node/23428 about this .. I'll follow up there.

''

Mon, 11/05/2012 - 06:26
gyorgy.chityil@...

Hello,

I notice the issue here https://www.virtualmin.com/node/23428 was marked as fixed, yet deletion seems to be failing for me now with the latest release. :)

The backup server is an sftp server that is always on. Local backup works fine and deletes fine.

Listing directories gives me

sftp> ls -la
drwxr-xr-x    4 u46155   u46155          4 Nov  5 11:58 .
drwxr-xr-x    3 u46155   u46155          3 Apr 21  2012 ..
drwxr-xr-x    2 u46155   u46155         59 Nov  2 05:54 02-11-2012
drwxr-xr-x    2 u46155   u46155         54 Nov  3 08:04 03-11-2012

I attach a screenshot of my backup settings. Nothing extraordinary I believe.

Mon, 11/05/2012 - 11:11
dshewmaker

Hello,

My backup schedules have been failing to delete for weeks and weeks now. Nothing has changed that I know of except for virtualmin updates and CentOS updates. Something broke the delete old backups. It never happens and there are no errors that I can see.

I backup to localhost and it was working for years.

So anybody else still running into this?

Dennis

Mon, 03/11/2013 - 10:23
stephanw

Hi First, thank's for this great software. I use it with pleasure.

I backup via ssh and deletion of old backups are not working. Would be nice, if someone could help!

Best regards Steve

Fri, 05/16/2014 - 04:14
inteq

Sorry for bumping an old thread but I too have the same problems.

Using two locations for backup. 1. NFS share with rw rights 2. Local volume

On both locations, deletions are not working.

I do not have a big problems with this as I have plenty of space,but would love to see it fixed or at least pointed in the right direction.

Fri, 05/16/2014 - 10:36 (Reply to #25)
JamieCameron

Is assume that if you run ls -l on the parent of those backup directories that it shows them with the expected last-modified dates?

''

Fri, 05/16/2014 - 14:35
inteq

# ls -l
total 276
drwxr-xr-x 2 nobody nogroup 4096 Apr 1 05:05 01-04-2014
drwx------ 2 nobody nogroup 4096 May 1 05:06 01-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 2 05:05 02-04-2014
drwx------ 2 nobody nogroup 4096 May 2 05:06 02-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 3 05:05 03-04-2014
drwx------ 2 nobody nogroup 4096 May 3 05:06 03-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 4 05:05 04-04-2014
drwx------ 2 nobody nogroup 4096 May 4 05:06 04-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 5 05:05 05-04-2014
drwx------ 2 nobody nogroup 4096 May 5 05:05 05-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 6 05:05 06-04-2014
drwx------ 2 nobody nogroup 4096 May 6 05:05 06-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 7 05:05 07-04-2014
drwx------ 2 nobody nogroup 4096 May 7 05:05 07-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 8 10:07 08-04-2014
drwx------ 2 nobody nogroup 4096 May 8 05:06 08-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 9 05:06 09-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 9 05:05 09-04-2014
drwx------ 2 nobody nogroup 4096 May 9 05:05 09-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 10 05:06 10-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 10 05:06 10-04-2014
drwx------ 2 nobody nogroup 4096 May 10 05:05 10-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 11 05:05 11-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 11 05:05 11-04-2014
drwx------ 2 nobody nogroup 4096 May 11 05:05 11-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 12 05:05 12-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 12 05:05 12-04-2014
drwx------ 2 nobody nogroup 4096 May 12 05:05 12-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 13 05:05 13-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 13 05:11 13-04-2014
drwx------ 2 nobody nogroup 4096 May 13 05:05 13-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 14 05:05 14-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 14 05:06 14-04-2014
drwx------ 2 nobody nogroup 4096 May 14 05:05 14-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 15 05:05 15-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 15 05:05 15-04-2014
drwx------ 2 nobody nogroup 4096 May 15 05:05 15-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 16 05:06 16-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 16 05:05 16-04-2014
drwx------ 2 nobody nogroup 4096 May 16 05:05 16-05-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 17 05:05 17-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 17 05:06 17-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 18 05:05 18-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 18 05:05 18-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 19 05:06 19-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 19 05:05 19-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 20 05:05 20-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 20 05:05 20-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 21 05:05 21-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 21 05:05 21-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 22 05:05 22-03-2014
drwxr-xr-x 2 nobody nogroup 4096 Apr 22 05:05 22-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 23 05:05 23-03-2014
drwx------ 2 nobody nogroup 4096 Apr 23 05:05 23-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 24 05:05 24-03-2014
drwx------ 2 nobody nogroup 4096 Apr 24 05:05 24-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 25 05:05 25-03-2014
drwx------ 2 nobody nogroup 4096 Apr 25 05:05 25-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 26 05:05 26-03-2014
drwx------ 2 nobody nogroup 4096 Apr 26 05:05 26-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 27 05:05 27-03-2014
drwx------ 2 nobody nogroup 4096 Apr 27 05:05 27-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 28 05:05 28-03-2014
drwx------ 2 nobody nogroup 4096 Apr 28 05:05 28-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 29 05:05 29-03-2014
drwx------ 2 nobody nogroup 4096 Apr 29 05:05 29-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 30 05:05 30-03-2014
drwx------ 2 nobody nogroup 4096 Apr 30 05:05 30-04-2014
drwxr-xr-x 2 nobody nogroup 4096 Mar 31 05:05 31-03-2014

Fri, 05/16/2014 - 19:22 (Reply to #27)
JamieCameron

That looks fine to me.

What message do you get when you try to run a backup? Does it try to clean up old backups but fail, or just say that no cleanup is needed?

''

Fri, 05/16/2014 - 20:10
inteq

XX servers backed up successfully, 0 had errors. 8 Virtualmin configuration settings backed up successfully. Backup is complete. Final size was 7.15 GB.

Deleting backups from local file /XXX/Hosting Backup/Virtualmin/Daily/%d-%m-%Y older than 7 days .. .. no backups to delete were found

Fri, 05/16/2014 - 22:51 (Reply to #29)
JamieCameron

Ok, so that means that it didn't find any candidate files to backup.

Does the backup directory perhaps need to be mounted before each backup?

''

Sat, 05/17/2014 - 02:19
inteq

No, the directory is located on a NFS share, mounted on start-up, with read+write permissions and always available.
The same backup is executed on a local volume, physical hard drive inside the server, but with a limit of 60 backups stored instead of 7.
At the moment, there are 69 backups and Virtualmin still thinks "no backups to delete were found".

First, I thought it can be a NFS problem, but it seems this occurs on normal volumes also.

Sat, 05/17/2014 - 12:53 (Reply to #31)
JamieCameron

I'm out of ideas as to why this would be happening. However, in the next Virtualmin release I will have it display more details as to why backups weren't deleted, which should help debug this further.

''

Sat, 05/17/2014 - 16:20
inteq

Quick fix for my problem.
In Virtualmin, edit the Scheduled Backup and under "Schedule and Reporting" you will find a "Command to run after backup" setting.
Set it to: find /YourBackupPath -type d -ctime +7 -exec rm -rf {} \;

Where -ctime +7 is the number of days you want to keep. Anything older will be deleted.
Tested and it works.

Fri, 09/05/2014 - 07:53 (Reply to #33)
elton35

i notice that the backup server is running VSFTPD, and the working virtualmin is running PROFTPD, so i have to shutdown the incorrect ftp server and start up proftpd like my working virtualmin to make sure that both are identical. I will test this tonight and comment my results here tomorrow