Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2022 11:50:39 +0200
From:      Tomek CEDRO <tomek@cedro.info>
To:        Andrea Venturoli <ml@netfence.it>
Cc:        ports <ports@freebsd.org>
Subject:   Re: Fill a disk with more recent files
Message-ID:  <CAFYkXj=kULDh%2BUwCsObE6ivE9R6UuC93PMmXf1%2BM134JtO0tgg@mail.gmail.com>
In-Reply-To: <40ed09f1-f4b9-d4bf-26fa-9a93e73b09bb@netfence.it>
References:  <b92d3ed6-0ea4-ff05-b53c-4427c6234eeb@netfence.it> <CAFYkXjk=XoiC93_wgaxDBCJcCpC_m0G=0oWdpHCR08Vm910fbg@mail.gmail.com> <40ed09f1-f4b9-d4bf-26fa-9a93e73b09bb@netfence.it>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Apr 27, 2022 at 10:09 AM Andrea Venturoli <ml@netfence.it> wrote:
> On 4/27/22 09:51, Tomek CEDRO wrote:
> > On Wed, Apr 27, 2022 at 9:48 AM Andrea Venturoli <ml@netfence.it> wrote:
> >> Hello.
> >> Suppose I have a large storage of files and a smaller disk (backup).
> >> I need to copy as much as I can from source to target and I want the
> >> most recent files.
> >> Before I start scripting and reinvent the wheel, is there some tool already?
> > rsync :-)
> Thanks for your answer.
> Rsync is what I've been using up to now.
> However I fail to find an option to tell it to sort the file from most
> recent to older. What is it?

rsync uses its own order as stated in man page:

SORTED TRANSFER ORDER
       Rsync always sorts the specified filenames into its internal transfer
       list.  This handles the merging together of the contents of identically
       named directories, makes it easy to remove duplicate filenames, and may
       confuse someone when the files are transferred in a different order
       than what was given on the command-line.

       If you need a particular file to be transferred prior to another,
       either separate the files into different rsync calls, or consider using
       --delay-updates (which doesn't affect the sorted transfer order, but
       does make the final file-updating phase happen much more rapidly).

If you want to enforce particular sort order you will have to call
rsync from another tool. Probably ls / find, sort, then rsync, maybe a
dedicated Python script.

That also depends on how do you want to treat existing backup files.
Do you want to delete them all completely on backup, or remove oldest
files in order to make a room for the new files?

Have you considered ZFS (full/incremental) snapshots and partitioning
your pool into areas based on backup priority? I use this method.

With ZFS you can frequently create incremental snapshots for important
locations and stream them into a backup file. Having smaller locations
to backup also makes initial full snapshot smaller and that allows
full workspace recovery. ZFS also allows quick access to a single
files from selected snapshots by entering
pool/this/was/my/work/folder/top/.zfs when its on the pool so you do
not have to even copy/extract anything.

Sorry I do not know any better out-of-the box solution matching your needs.

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFYkXj=kULDh%2BUwCsObE6ivE9R6UuC93PMmXf1%2BM134JtO0tgg>