Recently I accidentally whipped out a directory with important stuff, and now I'm starting to think about the best ways to have backups, a remote copy It's already in place but I was thinking, about

A scripts that replicates my directory structure in another directory, and makes hard links for all the files in the directory, so In case I delete something It still exists.

But my question here is,

  • Does git version control will still work?
  • Should I replicate the structure and make hard links for each file or hard links the the directories?

What I want is to be able to have a hard links to the same inodes, in some other place, so I don't harm the integrity of the files if I delete or something, the hard links should be updated with a cronjob, so I always have a pointer to them.

The concern is If git will respect the hardlinks?

  • Virtually no filesystems support hard links to directories so that's unlikely to be workable (HFS+ on macOS is basically the only one in common use, and even then you basically need to let Time Machine do it for you). It might help if you said what system you're using so people can see what's going to be viable. – Michael Homer Oct 21 '18 at 5:53
  • Could you also clarify what your use case is? It sounds like you're concerned about deleting a file from your work directories somewhere and want to make sure it doesn't actually go away when you do, because there's still a living hard link. Is that correct? In that case, note that most editing operations are going to break the hard link, so the copy will just be a snapshot of the point in time it was made and so not much better than a proper backup. If you're concerned about conserving backup space itself with hard links (i.e. incremental-ish backups), say so too. You can edit your post. – Michael Homer Oct 21 '18 at 5:57
  • If you are looking for snapshots and you are not using zfs/btrfs, you could check out rsnapshot.org . – sebasth Oct 21 '18 at 6:33
  • @MichaelHomer, exactly that, I edited the question, but still I don't know If the git operations will respect the hardlinks. – ekiim Oct 21 '18 at 6:55
  • 1
    So I suppose my question is: what do you mean with "respecting" hard links? Keeping the link, or breaking it? – ilkkachu Oct 21 '18 at 13:17

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.