[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: copy directory tree, mapping to new owners



On Tue 14 Sep 2021 at 08:50:34 (+0200), tomas@tuxteam.de wrote:
> On Tue, Sep 14, 2021 at 12:17:05PM +1200, Richard Hector wrote:
> > On 13/09/21 7:04 pm, tomas@tuxteam.de wrote:
> > >On Mon, Sep 13, 2021 at 11:45:02AM +1200, Richard Hector wrote:
> > >>On 12/09/21 6:52 pm, john doe wrote:
> > >
> > >[...]
> > >
> > >>>If you are doing this in a script, I would use a temporary directory.
> > >>>That way, in case of failure the destination directory is not rongly
> > >>>modified.
> > >>>
> > >>>EG:
> > >>>
> > >>>$ rsync <src-dir> <tmp-dir>
> > >>>
> > >>>Make <tmp-dir> the way you want it to be.
> > >>>
> > >>>$ rsync <tmp-dir> <dest-dir>
> > >>
> > >>That is true, but firstly it would require more available space [...]
> > >
> > >This isn't necessary, as you could replace the second `rsync' by a `mv'
> > >(provided your temp tree is on the same storage volume as your target
> > >dir, that is).
> > 
> > I was assuming the suggestion was to rsync the source to the temp
> > while the destination still exists, before rsyncing or mv'ing over
> > the top of it. Total of 3 copies (temporarily) rather than 2.
> 
> Then, it's different. But in your scenario you would probably want
> to take down whatever "service" relies on the destination dir while
> the copy is in progress.

As I read the first paragraph of the OP, the service relies on the
*source* files, and the destination is just the copy, being created
and/or updated for testing. I presume that is why the OP is not
too worried by failure.

> In any case, if you haven't the space, you haven't it. Sysadmin's
> life ain't always nice :)

Cheers,
David.


Reply to: