The documentation on backup file creation, Copying vs. Renaming, makes it sound like copying is the more sensible choice.

  • file owner and group remain unchanged
  • hard links remain associated with the actual file rather than its backup

Given that, why does the default behavior prefer renaming in most cases?

  • backup-by-copying defaults to nil
  • backup-by-copying-when-linked defaults to nil
  • backup-by-copying-when-mismatch defaults to t
  • 1
    This probably relates to how some file-systems treat copying and renaming. Some file-systems may use file-level deduplication, in which case no new data will be written in case of renaming, but will in case of copying... (this is just a guess). But then this isn't really very useful for backups... I think, it's best not to rely on defaults and choose the strategy after reading file-system documentation.
    – wvxvw
    Sep 24 '16 at 19:00
  • 1
    I guess for efficiency: copying has to write the file contents twice, renaming only once (see docstring of make-backup-files).
    – npostavs
    Sep 25 '16 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.