A reflink is a type of lightweight copy in btrfs and xfs.
Questions tagged [reflink]
10 questions
20
votes
1 answer
Why does "cp -R --reflink=always" perform a standard copy on a Btrfs filesystem?
Btrfs support Copy-On-Write. I tried to use that feature to clone a directory:
cp -R --reflink=always foo_directory foo_directory.mirror
I expected the command to finish almost instantly (like a btrfs subvolume snapshot), but the cp command seems…
Philipp Claßen
- 4,689
- 7
- 29
- 41
17
votes
1 answer
In Linux, which filesystems support reflinks?
btrfs supports reflinks, XFS supports reflinks (since 2017 I think?).
Are there any other filesystems that support it?
truncate -s 1G test.file;
cp --reflink=always test.file ref.test.file;
hanshenrik
- 585
- 4
- 20
9
votes
1 answer
Is there a way to enable reflink on an existing XFS filesystem?
I currently have a 4TB RAID 1 setup on a small, personal Linux server, which is formatted as XFS in LVM. I am interested in enabling the reflink feature of XFS, but I did not do so when I first created the filesystem (I used the defaults).
Is there…
TheSola10
- 201
- 2
- 8
7
votes
1 answer
What does a rmlint's "clone" for btrfs do?
I was reading the rmlint manual, and one of the duplicate handlers are clone and reflink:
· clone: btrfs only. Try to clone both files with the BTRFS_IOC_FILE_EXTENT_SAME ioctl(3p). This will physically delete duplicate extents. Needs at least…
Dan
- 9,372
- 5
- 25
- 39
6
votes
1 answer
Detect btrfs reflinked files
It's clear, with cp --reflink foo bar I can copy a file on btrfs without wasting space. But how can I detect that the two files (foo and bar here) are using the same "space unit"?
If they were hardlinks, I would use [ foo -ef bar ] for comparing or…
Daniel Alder
- 838
- 11
- 26
5
votes
2 answers
How to find out if the filesystem supports reflink copies?
I try to create a snapshot copy of a directory recursively, but it returns errors for every single file if the filesystem (custom shfs) does not support reflink copies:
# cp -a --reflink=always /mnt/user/libvirt /mnt/user/libvirt_copy
cp: failed to…
mgutt
- 377
- 2
- 16
3
votes
0 answers
Combine mkfifo and cp --reflink to append files without copying data
I have huge files {0..9}.bin which I want concatenate into out.bin. I don't need the original files afterwards. So I was wondering, if this is possible by only modifying the filesystem index without copying the file contents (see Append huge files…
darkdragon
- 175
- 5
2
votes
0 answers
Why so much btrfs-send data for reflinks
I'm experiencing a very weird Btrfs "send" issue with file reflinks, and after so many trials, I found the details:
First, I created a subvolume called "1":
btrfs subvolume create 1
and dd a file in it:
dd if=/dev/urandom of=1/a bs=64…
bczhc
- 21
- 3
2
votes
1 answer
GNU cp: What's the difference between `--link` and `--reflink=always`?
What's the difference between --link and --reflink=always?
I use the following command as an mv substitute, and I am wondering if using --reflink is a better choice.
command gcp -r --link --archive --verbose "${opts[@]}" "$@"
# delete the sources…
HappyFace
- 1,493
- 9
- 21
0
votes
1 answer
Reflink copy diff
I want to make a behaviour like btrfs send and btrfs receive, but on a per-file basis.
As far as I see it, I can use cp -ax --reflink=always to make a "snapshot" of the file.
Let's assume that two such "snapshots" on two different hard disks are…
user1994405
- 1
- 1