pkolaczk / fclones

Efficient Duplicate File Finder
MIT License
1.91k stars 71 forks source link

`fclones dedupe` does not preserve mtimes on Linux #86

Closed ivan closed 2 years ago

ivan commented 2 years ago

fclones dedupe doesn't seem to preserve mtimes on Linux. Preserving mtimes seems like something that should be both possible and desirable, but please let me know if I missed something.

I tested this with btrfs on NixOS 21.11-pre.

# uname -a
Linux ra 5.10.76-hardened1 #1-NixOS SMP Wed Oct 27 07:56:57 UTC 2021 x86_64 GNU/Linux

# fclones --version
fclones 0.17.0

# cp -a /etc/passwd ./

# touch --date 2009-01-01 passwd

# l
total 4,096
-rw-r--r-- 1 at at 3,891 2009-01-01 00:00 passwd

# cp -a passwd passwd.2

# l
total 8,192
-rw-r--r-- 1 at at 3,891 2009-01-01 00:00 passwd.2
-rw-r--r-- 1 at at 3,891 2009-01-01 00:00 passwd

# fclones group . | fclones dedupe
[2021-10-29 04:25:29.532] fclones:  info: Started grouping
[2021-10-29 04:25:29.540] fclones:  info: Scanned 3 file entries
[2021-10-29 04:25:29.540] fclones:  info: Found 2 (7.8 KB) files matching selection criteria
[2021-10-29 04:25:29.540] fclones:  info: Found 1 (3.9 KB) candidates after grouping by size
[2021-10-29 04:25:29.540] fclones:  info: Found 1 (3.9 KB) candidates after grouping by paths and file identifiers
[2021-10-29 04:25:29.552] fclones:  info: Found 1 (3.9 KB) candidates after grouping by prefix
[2021-10-29 04:25:29.552] fclones:  info: Found 1 (3.9 KB) candidates after grouping by suffix
[2021-10-29 04:25:29.552] fclones:  info: Found 1 (3.9 KB) redundant files
[2021-10-29 04:25:29.553] fclones:  info: Started deduplicating
[2021-10-29 04:25:29.561] fclones:  info: Processed 1 files and reclaimed up to 3.9 KB space

# l
total 8,192
-rw-r--r-- 1 at at 3,891 2009-01-01 00:00 passwd
-rw-r--r-- 1 at at 3,891 2021-10-29 04:25 passwd.2

I also tested a user xattr and it did seem to be preserved.

pkolaczk commented 2 years ago

@th1000s ^ any ideas?