this post was submitted on 10 Nov 2024
31 points (100.0% liked)

Linux

5230 readers
158 users here now

A community for everything relating to the linux operating system

Also check out !linux_memes@programming.dev

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 1 year ago
MODERATORS
top 6 comments
sorted by: hot top controversial new old
[–] Lojcs@lemm.ee 6 points 5 days ago (3 children)

I thought with cow file systems programs didn't have to explicitly reflink since normal copies are already reflinks?

[–] TechnicallyColors@lemm.ee 3 points 5 days ago* (last edited 5 days ago)

I'm still not sure I fully understand what's going on at the low-level, but there is a "How it works" section on the debcow github page that at least made an attempt to penetrate my skull.

Edit: I guess the main thing it's doing is skipping the .tar archive extraction, and ref-linking the raw bytes from the .tar into new files? Extacting the .tar normally will create standard files, and those files would be reflink copied to the new location, but that still requires a more or less "normal file copy" during the .tar extraction. This really has greater implications for allowing generic reflinking from .tar archives, instead of just being limited to package installation. Could be interesting if it was handled automatically during .tar extraction. Or I could be misunderstanding, which is equally likely.

[–] Hirom@beehaw.org 3 points 5 days ago

This isn't a basic copy of a whole file. This is creating a new file from a portion of an existing file.

[–] LaggyKar@programming.dev 2 points 5 days ago

A normal copy consists of a program reading from one file and writing to another. There is no way for the filesystem to do a reflink in that case, it just sees that the program is reading and writing stuff. In order to do a reflink, the program must tell the filesystem what data should be "copied" to where using FICLONE or FICLONERANGE. Though some programs will do that by default if possible nowadays when copying files or when moving files between different subvolumes on the same partition, including the Coreutils cp, mv and install commands and some GUI file managers.

[–] Hirom@beehaw.org 2 points 5 days ago (1 children)

Are there downsides to using reflinks, like alignment and read performance issues?

Compatibility shouldn't be an issue, ie it should be relatively simple and safe to have a fallback that copy when reflink isn't available.

[–] TechnicallyColors@lemm.ee 1 points 5 days ago

Fragmentation is a big one on mechanical harddrives. If you have 1000 video files that all share half of their pieces with each other, the disk is going to seek like crazy between them instead of reading sequentially during playback.