18

I have installed Lubuntu 15.04 on my EEE PC 701 with the file-system BTRFS. I want to deduplicate my data, but I don't know how.

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
wb9688
  • 1,437

2 Answers2

16

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

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • When I type duperemove -d I get the help page – wb9688 Jun 04 '15 at 06:00
  • 1
    What do you get when you type 'man duperemove? I believe you need to designate the files to run it on. as induperemove [options] files...` – Elder Geek Jun 04 '15 at 13:20
  • /me just yesterday have used it — FTR, the command is duperemove -rdh path1 path2 pathn, where -r for recursive, -d to actually deduplicate, and -h for human-readable numbers. – Hi-Angel Mar 26 '18 at 06:47
  • @Hi-Angel updated answer - added link to man page – Elder Geek Mar 26 '18 at 12:45
  • The ppa doesn't work for me - perhaps it doesn't support ARM? root@QuaStation1:~# apt-get install duperemove Reading package lists... Done Building dependency tree
    Reading state information... Done E: Unable to locate package duperemove
    – Noah Jul 01 '21 at 14:27
  • @Noah It's possible that it doesn't support ARM, In fact it's likely that this answer from 2015 refers to a package that's no longer actively developed. A quick look at the github page linked above indicates that "Mark Fasheh edited this page on Oct 14, 2016" What version of Ubuntu are you running? The last version uploaded to the PPA was in 2017 – Elder Geek Jul 02 '21 at 18:03
5

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).

Adam Ryczkowski
  • 4,403
  • 9
  • 40
  • 65