From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
To: "Christian Völker" <cvoelker@knebb.de>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: Defragmentation vw. Deduplication
Date: Wed, 3 Mar 2021 23:54:51 -0500 [thread overview]
Message-ID: <20210304045451.GM32440@hungrycats.org> (raw)
In-Reply-To: <11d7701c-4fd8-9bf1-c10e-755e55dd5e57@knebb.de>
On Tue, Mar 02, 2021 at 10:31:08PM +0100, Christian Völker wrote:
> Hi all,
>
> might be a simple question but I did not find a trustable source for this.
>
> BTRFS uses COW which might lead to fragmentation.
> So using "btrfs fi defrag -r /mnt" will bring most file extend in a row and
> copy previously deduplicated extends.
> Obviously this uses more disk space. This is not what I want, but I need to
> run "defrag" because I initially skipped the "compress=zstd" option when
> mounting. So many files are stored without compression. Therefor I neede to
> do the "defrag".
>
> I am now unsure about the deduplication itself. How does it work?
> I create a file in a directory (ie on Monday). Some days later I create a
> file which has some extents with equal data. Does btrfs recon the equal
> extents and does it doe deduplication then?
You have to run a deduper like duperemove or bees to get that behavior. See
https://btrfs.wiki.kernel.org/index.php/Deduplication
There are a number of different tools that are also available for other
filesystems as well, e.g. jdupes, which dedupe entire identical files
as opposed to blocks. If most of your duplicates are entire files then
this can significantly increase dedupe speed and reduce dedupe memory
compared to the block-oriented dedupers.
> Or does it only do deduplication when ie "cp --reflink" is used?
With cp --reflink there is no duplication in the first place.
You can choose a deduper depending on how much RAM and IO you want to
commit to the task, whether you need block- or file-oriented dedupe, etc.
If you don't run a deduper then duplicate data stays duplicated.
If you don't run defrag then reflinked data stays reflinked.
> However as I needed the compression and not the defragmentation is there any
> way to add compression and recreate deduplication later?
You can simply run a deduper after compression is done.
> Sorry if this is a dumb question.
>
> /KNEBB
>
>
prev parent reply other threads:[~2021-03-04 4:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 21:31 Defragmentation vw. Deduplication Christian Völker
2021-03-04 4:54 ` Zygo Blaxell [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210304045451.GM32440@hungrycats.org \
--to=ce3g8jdj@umail.furryterror.org \
--cc=cvoelker@knebb.de \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).