1 |
On 09/16/2017 07:06 AM, Kai Krakow wrote: |
2 |
> Am Fri, 15 Sep 2017 14:28:49 -0400 |
3 |
> schrieb Rich Freeman <rich0@g.o>: |
4 |
> |
5 |
>> On Fri, Sep 8, 2017 at 3:16 PM, Kai Krakow <hurikhan77@×××××.com> |
6 |
>> wrote: |
7 |
>>> |
8 |
>>> At least in btrfs there's also a caveat that the original extents |
9 |
>>> may not actually be split and the split extents share parts of the |
10 |
>>> original extent. That means, if you delete the original later, the |
11 |
>>> copy will occupy more space than expected until you defragment the |
12 |
>>> file: |
13 |
>> |
14 |
>> True, but keep in mind that this applies in general in btrfs to any |
15 |
>> kind of modification to a file. If you modify 1MB in the middle of a |
16 |
>> 10GB file on ext4 you end up it taking up 10GB of space. If you do |
17 |
>> the same thing in btrfs you'll probably end up with the file taking up |
18 |
>> 10.001GB. Since btrfs doesn't overwrite files in-place it will |
19 |
>> typically allocate a new extent for the additional 1MB, and the |
20 |
>> original content at that position within the file is still on disk in |
21 |
>> the original extent. It works a bit like a log-based filesystem in |
22 |
>> this regard (which is also effectively copy on write). |
23 |
> |
24 |
> Good point, this makes sense. I never thought about that. |
25 |
> |
26 |
> But I guess that btrfs doesn't use 10G sized extents? And I also guess, |
27 |
> this is where autodefrag jumps in. |
28 |
|
29 |
According to btrfs-filesystem(8), defragmentation breaks reflinks, in |
30 |
all but a few old kernel versions where I guess they tried to fix the |
31 |
problem and apparently failed. This really makes much of what btrfs does |
32 |
altogether pointless if you ever defragment manually or have autodefrag |
33 |
enabled. Deduplication is broken for the same reason. |