2

The jdupes deduplication program allows you to create hardlinks, so that the files are not deleted, but linked together so that the disk space is used only once for multiple copies.

Is there a way to control which file of the duplicates is kept? Normally it would not matter, but when using volume or file system snapshots, replacing a file in a snapshot with a link to a new copy only frees space when the snapshot is deleted. Linking the file from the snapshot to the new copy (which is not yet in any snapshot) will free space.

1 Answer 1

2

I'm the author of jdupes. No, you can't do that in the program itself, at least not yet. I'm working on 2.0 which will pave the way for such things in the future, but this is probably not happening anytime soon enough for you. Instead, take a look at the jdupes source code example scripts. You can feed the normal output to a custon shell script which will do whatever you want, however you want, and that directory has several examples you can modify as needed.

You might be able to exert some control over this by using -O which will place items in specified order first; for example, jdupes -rLO dir1 dir2 will put items in dir1 ahead of items in dir2. Make dir1 the snapshot and it may work for you.

If you ever have a question or issue related to jdupes, you're always free to contact me directly.

1
  • 1
    Thanks! The -O option method is probably sufficient for BTRFS snapshots which are always a full directory anyway.
    – allo
    Commented Dec 20, 2023 at 0:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .