Re: move instead of copy
Mario Emmenlauer <[email protected]> Wed, 16 Sep 2015 10:02:49 +0200
| Newsgroups | gmane.network.unison.devel |
|---|---|
| Message-ID | <[email protected]> |
On 15.09.2015 23:51, Julian Squires wrote:
> I am considering implementing this.
>
> At least in the case of Posix systems, couldn't one rename(2) and if
> it fails with EXDEV, then fall back to copy-and-delete?
It would be great if an ocaml-literate person could look into this,
thanks in advance! I think this approach seems reasonable if you have
a solid check for errors/failure around the rename(2).
One thing to consider is that rename will leave hardlinks intact,
which is a very desirable behaviour for making backups with unison!
Please if possible try to achieve an implementation that keeps the
hardlinks when using rename(2) - it should work out of the box, but
might still be worth to keep in mind.
Cheers,
Mario
> On Tue, Sep 15, 2015 at 12:51 PM, Trevor Jim <[email protected]> wrote:
>> As I recall, the reason for the copy is that sometimes move is not
>> atomic.
>>
>> For example, a move from one hard disk to another is actually a copy and
>> a delete. The copy could fail in the middle.
>>
>> It is hard to tell how a move will be implemented from just the path of
>> source and destination.
>>
>> Using copy+delete instead of a move is therefore a safer approach, since
>> Unison knows that copies can fail and takes this into account so that
>> you do not lose data.
>>
>> Something to keep in mind...
>>
>> -Trevor
--
BioDataAnalysis GmbH, Mario Emmenlauer Mobil: +49-(0)151-68108489
Balanstrasse 43 mailto: memmenlauer * biodataanalysis.de
D-81669 München http://www.biodataanalysis.de/