How can I deduplicate my data with BTRFS?

Start by making a full backup so that if something goes wrong you haven't lost anything.

I believe you are looking for duperemove -d

"Duperemove is a simple tool for finding duplicated extents and submitting them for deduplication. When given a list of files it will hash their contents on a block by block basis and compare those hashes to each other, finding and categorizing extents that match each other. When given the -d option, duperemove will submit those extents for deduplication using the btrfs-extent-same ioctl.

Duperemove has two major modes of operation one of which is a subset of the other.

Readonly / Non-deduplicating Mode

When run without -d (the default) duperemove will print out one or more tables of matching extents it has determined would be ideal candidates for deduplication. As a result, readonly mode is useful for seeing what duperemove might do when run with '-d'. The output could also be used by some other software to submit the extents for deduplication at a later time.

It is important to note that this mode will not print out all instances of matching extents, just those it would consider for deduplication.

Generally, duperemove does not concern itself with the underlying representation of the extents it processes. Some of them could be compressed, undergoing I/O, or even have already been deduplicated. In dedupe mode, the kernel handles those details and therefore we try not to replicate that work.

Deduping Mode

This functions similarly to readonly mode with the exception that the duplicated extents found in our "read, hash, and compare" step will actually be submitted for deduplication. An estimate of the total data deduplicated will be printed after the operation is complete. This estimate is calculated by comparing the total amount of shared bytes in each file before and after the dedupe.

See the duperemove man page for further details about running duperemove."

this doesn't seem to appear in the btrfs-tools package but there is a git hub page for it here. Recent open and closed issues (aka pulse) available here.

Packages for All currently supported versiosn of Ubuntu can be found in this PPA

I must re-iterate that backing up is highly recommended. See: https://github.com/markfasheh/duperemove/issues/50

Quoted Source: https://github.com/markfasheh/duperemove

man page: https://manpages.debian.org/testing/duperemove/duperemove.8.en.html


I always used bedup. It is very fast and reliable. This tool is also mentioned on official btrfs page. I've never used duperemove (bedup is older).

Tags:

Btrfs