Skip to contentSkip to conversation

Can you keep reflink relationship during a copy/backup to another filesystem?

DISCUSSION Marc MERLIN 2 participants 3 messages Jan 29, 2014 – Feb 7, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

So I used to use hardlinks to do historical backups of the same filesystem but I know it's preferable to use refllink with btrfs to avoid having too many hardlinks.

But if I need to backup this filesystem to another one some other way than btrfs send/receive (let's say cp -a, tar, or rsync), is it correct to say that reflink relationships will be lost and my data will take more space?

That is unless the target filesytem can do deduplication like btrs now can? (I haven't tried it yet, but it's about time that I do)

Thanks,
Marc

Signature · 4 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/  
#1 lore raw
Quoted 3 lines · Marc MERLIN

So I used to use hardlinks to do historical backups of the same filesystem but I know it's preferable to use refllink with btrfs to avoid having too many hardlinks.

If you use btrfstune to set the "extended inode refs" option on the
device, then there's no hardlink limit (and the limit was only on the number of hardlinks to the same thing *in the same directory*).

Quoted 6 lines

But if I need to backup this filesystem to another one some other way than btrfs send/receive (let's say cp -a, tar, or rsync), is it correct to say that reflink relationships will be lost and my data will take more space?

That is unless the target filesytem can do deduplication like btrs now can? (I haven't tried it yet, but it's about time that I do)

Correct.

Hugo.

Signature · 3 lines
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 65E74AC0 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
               --- vi vi vi:  the Editor of the Beast. ---               
#2 lore raw
Quoted 7 lines · Hugo Mills
Quoted 3 lines · Marc MERLIN

So I used to use hardlinks to do historical backups of the same filesystem but I know it's preferable to use refllink with btrfs to avoid having too many hardlinks.

If you use btrfstune to set the "extended inode refs" option on the
device, then there's no hardlink limit (and the limit was only on the

I'm not too clear about that part:
https://btrfs.wiki.kernel.org/index.php/Btrfstune
doesn't seem to match what you're saying.

Quoted 1 line

number of hardlinks to the same thing *in the same directory*).

I didn't catch the 'same directory' part. I used hardlinks.py to compare all my files from many backups across filesystems and hardlink files together if they were the same.
You're saying that I could have 500 hardlinks to the same file as long as they are in 500 different directories, and that this is not a performance problem or limitation for btrfs (maybe anymore? I could swear I had issues with this in the past).

If the limit is now hardlinking many times to the same file in the same directory, I don't actually have a need for that use case.

Quoted 8 lines
Quoted 6 lines

But if I need to backup this filesystem to another one some other way than btrfs send/receive (let's say cp -a, tar, or rsync), is it correct to say that reflink relationships will be lost and my data will take more space?

That is unless the target filesytem can do deduplication like btrs now can? (I haven't tried it yet, but it's about time that I do)

Correct.

Thanks.
I just noticed that on the fly deduplication wasn't in 3.12 yet, so I'm better off keeping my hardlinks for backups since it's easy to keep that relationship when copying my backup tree to a backup device (backups of backups, of course, y'all don't do that? :) ).

Thanks,
Marc

Signature · 4 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/