Skip to content

Instantly share code, notes, and snippets.

@braindevices
Created September 3, 2024 20:41
Show Gist options
  • Save braindevices/4f7080579eb7010bdf1e9fc950388181 to your computer and use it in GitHub Desktop.
Save braindevices/4f7080579eb7010bdf1e9fc950388181 to your computer and use it in GitHub Desktop.
reflink can directly work with mounted volumes if the volumes are on the same host partition

reflink in mounted volume

podman run -v /data/devspace/dummy/test/A:/mnt/A:Z -v /data/devspace/dummy/test/B:/mnt/B:Z --rm -it ubuntu:latest /bin/bash

following works fine

root@68ec02c9b450:/mnt# cp --reflink=always A/test10M.bin A/reflinked.bin
[dummy@host test]$ xfs_io -r -c 'fiemap' A/reflinked.bin 
A/reflinked.bin:
        0: [0..20479]: 29692735488..29692755967
[dummy@host test]$ xfs_io -r -c 'fiemap' A/test10M.bin 
A/test10M.bin:
        0: [0..20479]: 29692735488..29692755967

cross different mount also works

root@68ec02c9b450:/mnt# cp --reflink=always A/test10M.bin B/reflinked.bin
[dummy@host test]$ xfs_io -r -c 'fiemap' B/reflinked.bin 
B/reflinked.bin:
        0: [0..20479]: 29692735488..29692755967

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment