Delete directories without browsing them
AZ 9901
az9901 at gmail.com
Sat Aug 3 10:21:04 MDT 2013
Le 6 avr. 2013 à 16:57, AZ 9901 a écrit :
> I make my production backups with Rsync.
>
>
> Here is an example of my backup tree on the destination server :
> /backups
> /2013-04-03
> /2013-04-02
> /2013-04-01
> /2013-03-31
> /2013-03-30
> /2013-03-29
>
> At the end of the backup process, I upload a logfile in the backup
> directory and delete oldest backups.
>
> For this, I use an include/exclude file, for example this inclexcl.txt :
> + /2013-04-03
> + /2013-04-03/logfile.log
> - /2013-04-03/*
> - /2013-04-02
> - /2013-04-01
>
> I also use this empty directory where my logfile is :
> /tmp
> /path
> /2013-04-03
> /logfile.log
>
> And I run this rsync command :
> rsync -a --delete-after --exclude-from=inclexcl.txt /tmp/path/
> myserver::backups/
>
> Perfect, it works, my logfile is uploaded and oldest backups are
> deleted (in this example all backups of March).
>
>
> However, what I can see in the daemon log is that Rsync is browsing
> from the top down all files of the backup directories to delete, and
> delete them one by one.
> As each of my backup directories contains hundreds of thousands of
> files, deletion take a very long time and eats a lot of IOs.
>
> Is there a way to tell Rsync to directly delete backup directories at
> the top of the hierarchy without browsing them ?
Le 7 avr. 2013 à 11:25, AZ 9901 a écrit :
> I made some tests, I created a directory with 300k files in it.
> I deleted it with Rsync, then with rm command.
> I did this test several times.
> On my server, it took about 20 seconds with rm, about 40 seconds with Rsync.
>
> In the Rsync deamon logfile, I can see a "del." line for each file of the directory, beginning from the top down.
> Does Rsync compares each file against the incl/excl list to know if it can be deleted ?
>
> If so, is there a way to tell Rsync the following ?
> "delete this top directory and all its files, but stop lacking time with comparisons against the incl/excl list for each element of this top directory"
Hello !
Wayne, do you have any idea about this ?
Thank you very much !
Best regards,
Ben
More information about the rsync
mailing list