Re: What is needed for ZFS block cloning to work?
Alan Somers <[email protected]> Sat, 11 Jul 2026 18:15:58 -0600
| Newsgroups | gmane.os.freebsd.devel.file-systems |
|---|---|
| Message-ID | <CAOtMX2gbmJJpa6=0zTO=Sy8La7nvsgDUj7=L6QP0xRR5s_7U=A@mail.gmail.com> |
On Sat, Jul 11, 2026 at 3:35=E2=80=AFPM John F Carr <[email protected]> wrote: > > I enabled block cloning on 15.1-STABLE but copy_file_range > between two files in the same directory does not cause > bcloneused to change. I have vfs.zfs.bclone_enabled=3D1 > and feature@block_cloning=3Denabled. Is anything more > needed? > > I looked at zfs_clone_range and zfs_freebsd_copy_file_range > and saw nothing obvious that would make the copy fail. > > zpool list shows ALLOC changing by an amount similar to the > size of the copied file. > > John Carr > > > $ zpool get bcloneused data > NAME PROPERTY VALUE SOURCE > data bcloneused 0 - > $ df . > Filesystem 1K-blocks Used Avail Capacity Mounted on > data/scratch 104857600 129665 104727934 0% /data/scratch > $ truss -o /tmp/t cp IMG_6998.CR3 tmp2 > $ zpool get bcloneused data > NAME PROPERTY VALUE SOURCE > data bcloneused 0 - > $ grep copy_file_range /tmp/t > copy_file_range(0x3,0x0,0x4,0x0,0x7fffffffffffffff,0x0) =3D 33289458 (0x1= fbf4f2) > copy_file_range(0x3,0x0,0x4,0x0,0x7fffffffffffffff,0x0) =3D 0 (0x0) > $ sysctl vfs.zfs.bclone_enabled > vfs.zfs.bclone_enabled: 1 > $ zpool get feature@block_cloning data > NAME PROPERTY VALUE SOURCE > data feature@block_cloning enabled local > > (kgdb) p zfs_bclone_enabled > $1 =3D 1 IIRC the recsize property on the destination file system also needs to match the record size of the source file (which is usually equal to the source file system's recsize). And there are also some restrictions around copying to/from encrypted file systems.