[Nottingham] Copy without copying? (file copy deduplication)

Martin martin at ml1.co.uk
Mon Jun 10 10:24:09 UTC 2019


Jason,

The obvious fix for that is to use btrfs whereby:

You have your pristine folders in one btrfs subvolume (can even be
mounted or set to be read-only);

Then create a snapshot subvolume from that first subvolume;

Your new snapshot subvolume can then be used or mounted read-write.


Aside: Note that you don't even need to mount the subvolumes as separate
mounts: they can even appear as 'normal' directories on a (single)
higher mount point.


The snapshot volume is created with zero copying of files and is very
fast and low resource to do. You'll see no increase in disk usage!

During use, the only file writing will be only for whatever new data is
actually written. The magic of the btrfs CoW means that only new blocks
of data get written. Unchanged file fragments remain unchanged and
uncopied...


Hope that fits your needs?

Cheers,
Martin



On 10/06/2019 11:04, J J via Nottingham wrote:
> I need read/write access to the new folder.
> Mucking around with OverlayFS I can effectively have a "Template" folder
> and then a "Working" folder (plus a couple of others for reasons) and
> that works well. Except for the fact that full file copies still happen
> and some of these files are big.
> So the situation is definitely better, but far from ideal.
> 
> I am going to see if I can grok XFS enough to do the similar thing, but
> do some block-level magics.
> LVM snapshots might also do it, but not sure if they would allow for
> multiple, concurrent "Working" folders and AIUI that would mean mucking
> around with how the system is deployed, not something I have control over.
> 
> The other wrinkle is that this needs t be done ad hoc.
> But first things first...




More information about the Nottingham mailing list